oef/node_modules/module-to-cdn
2020-01-29 13:35:12 +01:00
..
node_modules Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00
index.js Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00
license Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00
modules.json Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00
package.json Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00
readme.md Use CDN for js and css libraries 2020-01-29 13:35:12 +01:00

module-to-cdn Build Status Greenkeeper badge

Get cdn config from npm module name

Install

$ npm install --save module-to-cdn

Usage

const moduleToCdn = require('module-to-cdn');

moduleToCdn('react', '15.3.0');
/* => {
    name: 'react',
    var: 'React',
    url: 'https://unpkg.com/react@15.3.0/dist/react.min.js',
    version: '15.3.0'
}
*/

API

moduleToCdn(moduleName, version, options)

return the result Object or null (if module couldn't be find)

moduleName

Type: string

The name of the module

version

Type: string

The version of the module

options

options.env

Type: string
Values: development, production
Default: development

Result

  • name: name of the module
  • var: name of the global variable exposing the module
  • url: url where the module is available
  • version: the version asked for

License

MIT © Thomas Sileghem