diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8c11fc7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright JS Foundation and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 6c18235..18639a3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,85 @@ -# script loader for webpack +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![tests][tests]][tests-url] +[![coverage][cover]][cover-url] +[![chat][chat]][chat-url] -## Usage +
+ + + +

Script Loader

+
-``` javascript -require("script-loader!./file.js"); -// => execute file.js once in global context +

Install

+ +```bash +npm install --save-dev script-loader +``` + +

Usage

+ +Executes JS script once in global context. + +> :warning: Doesn't work in NodeJS + +### Config (recommended) + +```js +import exec from 'script.exec.js'; +``` + +**webpack.config.js** +```js +module.exports = { + module: { + rules: [ + { + test: /\.exec.js$/, + use: [ 'script-loader' ] + } + ] + } +} ``` -[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) +### Inline + +```js +import exec from 'script-loader!./script.js'; +``` + +

Maintainer

+ + + + + + + +
+ +
+ Tobias Koppers +
+ + +[npm]: https://img.shields.io/npm/v/script-loader.svg +[npm-url]: https://npmjs.com/package/script-loader + +[node]: https://img.shields.io/node/v/script-loader.svg +[node-url]: https://nodejs.org + +[deps]: https://david-dm.org/webpack/script-loader.svg +[deps-url]: https://david-dm.org/webpack/script-loader -Does nothing in node.js. +[tests]: http://img.shields.io/travis/webpack/script-loader.svg +[tests-url]: https://travis-ci.org/webpack/script-loader -## License +[cover]: https://coveralls.io/repos/github/webpack/script-loader/badge.svg +[cover-url]: https://coveralls.io/github/webpack/script-loader -MIT (http://www.opensource.org/licenses/mit-license.php) +[chat]: https://badges.gitter.im/webpack/webpack.svg +[chat-url]: https://gitter.im/webpack/webpack