rbren / rss-parser

A lightweight RSS parser, for Node and the browser
MIT License
1.39k stars 209 forks source link

Publish to CDN #162

Open stokito opened 4 years ago

stokito commented 4 years ago

It would be really nice if you can publish the library on some CDN. For example on cdnjs.com. Anyway, since the lib is already published on NPM then we can use https://unpkg.com/ CDN. I tried and this worked for me:

<script src="https://unpkg.com/rss-parser/dist/rss-parser.min.js"></script>

Ideally I wanted to include it as https://unpkg.com/rss-parser/ but then it will return index.js file which is for NodeJS. Also there is a lot of included dependencies which may be already included into my page. In their documentation said that library author should prepare some UMD file:

Workflow
For npm package authors, unpkg relieves the burden of publishing your code to a CDN in addition to the npm registry. All you need to do is include your UMD build in your npm package (not your repo, that's different!).

You can do this easily using the following setup:

Add the umd (or dist) directory to your .gitignore file
Add the umd directory to your files array in package.json
Use a build script to generate your UMD build in the umd directory when you publish
That's it! Now when you npm publish you'll have a version available on unpkg as well.
pesarkhobeee commented 1 year ago

Would be nice to have this, is there any hope to address this issue @rbren ? 🥺