Fang plugin to use babel.
- 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 };
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 };
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 };