diff --git a/README.md b/README.md index 6dccb85..ffda980 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,151 @@ -# coffee-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 +
+ + + + +

Coffee Loader

+
-``` javascript -var exportsOfFile = require("coffee-loader!./file.coffee"); -// => return exports of executed and compiled file.coffee +

Install

-var exportsOfFile2 = require("coffee-loader?literate!./file.litcoffee"); -// can also compile literate files. +```bash +npm install --save-dev coffee-loader ``` -[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) +

Usage

-### Recommended configuration -``` javascript -{ - module: { - loaders: [ - { test: /\.coffee$/, loader: "coffee-loader" }, - { test: /\.(coffee\.md|litcoffee)$/, loader: "coffee-loader?literate" } - ] - } +```js +import coffee from 'coffee-loader!./file.coffee'; +``` + +### Configuration (recommended) + + +```js +import coffee from 'file.coffee'; +``` + +**webpack.config.js** +```js +module.exports = { + module: { + rules: [ + { + test: /\.coffee$/, + use: [ 'coffee-loader' ] + } + ] + } +} +``` + +

Options

+ +|Name|Default|Description| +|:--:|:-----:|:----------| +|**`literate`**|`false`|Enable CoffeeScript in Markdown (Code Blocks) e.g `file.coffee.md`| +|**`sourceMap`**|`false`|Enable/Disable Sourcemaps| + +### [Literate](http://coffeescript.org/#literate) + +**webpack.config.js** +```js +module.exports = { + module: { + rules: [ + { + test: /\.coffee.md$/, + use: [ + { + loader: 'coffee-loader', + options: { literate: true } + } + ] + } + ] + } } ``` -## License +### Sourcemaps + +**webpack.config.js** +```js +module.exports = { + module: { + rules: [ + { + test: /\.coffee$/, + use: [ + { + loader: 'coffee-loader', + options: { sourceMap: true } + } + ] + } + ] + } +} +``` + +

Maintainer

+ + + + + + + + + + +
+ +
+ Juho Vepsäläinen +
+ +
+ Joshua Wiens +
+ +
+ Kees Kluskens +
+ +
+ Sean Larkin +
+ + +[npm]: https://img.shields.io/npm/v/coffee-loader.svg +[npm-url]: https://npmjs.com/package/coffee-loader + +[node]: https://img.shields.io/node/v/coffee-loader.svg +[node-url]: https://nodejs.org + +[deps]: https://david-dm.org/webpack/coffee-loader.svg +[deps-url]: https://david-dm.org/webpack/coffee-loader + +[tests]: http://img.shields.io/travis/webpack/coffee-loader.svg +[tests-url]: https://travis-ci.org/webpack/coffee-loader + +[cover]: https://coveralls.io/repos/github/webpack/coffee-loader/badge.svg +[cover-url]: https://coveralls.io/github/webpack/coffee-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