@khalyomede/fang-browserify
v0.1.1
Published
Fang plugin to use browserify
Downloads
3
Maintainers
Readme
Fang Browserify
Fang plugin to use browserify.
Summary
Installation
- Install fang
npm install --save-dev @khalyomede/fang@0.*
- Install this package
npm install --save-dev @khalyomede/fang-browserify@0.*
- Create a script alias
// package.json
{
"scripts": {
"fang": "fang"
}
}
- Create a task file (at the root of your folder)
// fang.js
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify())
.save('dist/js');
const build = [js];
module.exports = { build };
Usage
Example 1: simple usage
In this example, we will convert our modules imports into a browser-compatible javascript code.
// fang.js
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify())
.save('dist/js');
const build = [js];
module.exports = { build };
Example 2: with options
In this example, we are using some of the options provided by browserify to customize the behavior of this module.
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify({
debug: true // add a soure map inlined at the end of the file
}))
.save('dist/js');
const build = [js];
module.exports = { build };