Skip to content

khalyomede/fang-babel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fang Babel

Fang plugin to use babel.

Summary

Installation

  1. Install fang
npm install --save-dev @khalyomede/fang@0.*
  1. Install this plugin
npm install --save-dev @khalyomede/fang-babel@0.*
  1. 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 };