Skip to content

Commit

Permalink
feat: add transpile option (options.transpile) (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladflip authored and joshwiens committed Oct 5, 2017
1 parent 995e7b8 commit abaf498
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npm install --save-dev coffee-loader
import coffee from 'coffee-loader!./file.coffee';
```

### Configuration (recommended)
### `Configuration (recommended)`


```js
Expand All @@ -56,8 +56,9 @@ module.exports = {
|:--:|:-----:|:----------|
|**`literate`**|`false`|Enable CoffeeScript in Markdown (Code Blocks) e.g `file.coffee.md`|
|**`sourceMap`**|`false`|Enable/Disable Sourcemaps|
|**`transpile`**|`false`|Provide Babel presets and plugins|

### [Literate](http://coffeescript.org/#literate)
### [`Literate`](http://coffeescript.org/#literate)

**webpack.config.js**
```js
Expand All @@ -78,7 +79,7 @@ module.exports = {
}
```

### Sourcemaps
### `Sourcemaps`

**webpack.config.js**
```js
Expand All @@ -99,6 +100,31 @@ module.exports = {
}
```

### [`Transpile`](http://coffeescript.org/#transpilation)

**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.coffee$/,
use: [
{
loader: 'coffee-loader',
options: {
transpile: {
presets: ['env']
}
}
}
]
}
]
}
}
```

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

<table>
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = function(source) {
sourceMap: true,
sourceRoot: "",
sourceFiles: [coffeeRequest],
generatedFile: jsRequest
generatedFile: jsRequest,
transpile: query.transpile
});
} catch (e) {
var err = "";
Expand Down

1 comment on commit abaf498

@egoist
Copy link

@egoist egoist commented on abaf498 Oct 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you publish this on npm? 😄

Please sign in to comment.