0.1.0 • Published 5 years ago

@khalyomede/fang-babel v0.1.0

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

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