Skip to content

Commit

Permalink
Merge pull request #23 from michael-ciniawsky/readme
Browse files Browse the repository at this point in the history
docs(README): refactor for webpack v2
  • Loading branch information
joshwiens authored Feb 21, 2017
2 parents d6139fa + 121f713 commit b2f47d7
Showing 1 changed file with 140 additions and 19 deletions.
159 changes: 140 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
<div align="center">
<img width="160" height="160"
src="https://cdn.worldvectorlogo.com/logos/coffeescript.svg">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" hspace="20"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Coffee Loader</h1>
</div>

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

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)
<h2 align="center">Usage</h2>

### 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' ]
}
]
}
}
```

<h2 align="center">Options</h2>

|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 }
}
]
}
]
}
}
```

<h2 align="center">Maintainer</h2>

<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
</br>
<a href="https://github.com/bebraw">Juho Vepsäläinen</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
</br>
<a href="https://github.com/d3viant0ne">Joshua Wiens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
</br>
<a href="https://github.com/SpaceK33z">Kees Kluskens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
</br>
<a href="https://github.com/TheLarkInn">Sean Larkin</a>
</td>
</tr>
<tbody>
</table>


[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

0 comments on commit b2f47d7

Please sign in to comment.