dylang / node-rss

RSS feed generator for Node.
https://npmjs.org/package/rss
MIT License
999 stars 133 forks source link

Ability to add a stylesheet #65

Open lolmaus opened 7 years ago

lolmaus commented 7 years ago

https://www.petefreitag.com/item/208.cfm

<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="http://you.com/rss.css" ?>
...
dustinlarimer commented 10 months ago

@lolmaus, and anyone looking for a workaround – try this:

const feed = new RSS({
  /* config */
});

const response = feed.xml().replace(
    `<?xml version="1.0" encoding="UTF-8"?>`,
    `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/pretty-feed-v3.xsl" type="text/xsl"?>`
)
console.log(response)

This response will now contain a reference to stylesheet (XSL).

Here's a great template for getting started.