@khalyomede/fang-babel
v0.1.0
Published
Fang plugin to use babel.
Downloads
1
Maintainers
Readme
Fang Babel
Fang plugin to use babel.
Summary
Installation
- Install fang
npm install --save-dev @khalyomede/fang@0.*
- Install this plugin
npm install --save-dev @khalyomede/fang-babel@0.*
- Create a task file (on the root of your folder)
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');
const js = () => fang.from('src/js/**/*.js')
.do(babel())
.save('dist/js');
const build = [js];
module.exports = { build };
Usage
Example 1: simple usage
In this example, we will convert our javascript files to supports earlier browser using babel.
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');
const js = () => fang.from('src/js/**/*.js')
.do(babel())
.save('dist/js');
const build = [js];
module.exports = { build };
Example 2: with options
In this example, we will ask babel to add an additional inlined source map using the options parameter of this plugin.
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');
const js = () => fang.from('src/js/**/*.js')
.do(babel({
sourceMaps: 'inline'
}))
.save('dist/js');
const build = [js];
module.exports = { build };