0.1.1 • Published 5 years ago

@khalyomede/fang-browserify v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Fang Browserify

Fang plugin to use browserify.

Summary

Installation

  1. Install fang
npm install --save-dev @khalyomede/fang@0.*
  1. Install this package
npm install --save-dev @khalyomede/fang-browserify@0.*
  1. Create a script alias
// package.json
{
  "scripts": {
    "fang": "fang"
  }
}
  1. 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 };