项目作者: khalyomede

项目描述 :
Fang plugin to use babel.
高级语言: JavaScript
项目地址: git://github.com/khalyomede/fang-babel.git
创建时间: 2019-03-30T14:36:15Z
项目社区:https://github.com/khalyomede/fang-babel

开源协议:MIT License

下载


Fang Babel

@khalyomede/fang-pug">Fang plugin to use babel.

Summary

Installation

  1. Install @khalyomede/fang-pug">fang
  1. npm install --save-dev @khalyomede/fang@0.*
  1. Install this plugin
  1. npm install --save-dev @khalyomede/fang-babel@0.*
  1. Create a task file (on the root of your folder)
  1. // fang.js
  2. const fang = require('@khalyomede/fang');
  3. const babel = require('@khalyomede/fang-babel');
  4. const js = () => fang.from('src/js/**/*.js')
  5. .do(babel())
  6. .save('dist/js');
  7. const build = [js];
  8. module.exports = { build };

Usage

Example 1: simple usage

In this example, we will convert our javascript files to supports earlier browser using babel.

  1. // fang.js
  2. const fang = require('@khalyomede/fang');
  3. const babel = require('@khalyomede/fang-babel');
  4. const js = () => fang.from('src/js/**/*.js')
  5. .do(babel())
  6. .save('dist/js');
  7. const build = [js];
  8. 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.

  1. // fang.js
  2. const fang = require('@khalyomede/fang');
  3. const babel = require('@khalyomede/fang-babel');
  4. const js = () => fang.from('src/js/**/*.js')
  5. .do(babel({
  6. sourceMaps: 'inline'
  7. }))
  8. .save('dist/js');
  9. const build = [js];
  10. module.exports = { build };