Skip to content

khalyomede/fang-browserify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fang Browserify

Fang plugin to use browserify.

npm npm (prod) dependency version Snyk Vulnerabilities for npm package NPM

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 };