yucho / metalsmith-babel

Metalsmith plugin for Babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

metalsmith-babel

npm version Build Status Build status Coverage Status

Babel plugin for Metalsmith

Installation

Use npm:

npm install metalsmith-babel

And ensure the requisite Babel plugins are installed.

Usage

CLI

Add the metalsmith-babel field to your metalsmith.json.

{
  "plugins": {
    "metalsmith-babel": {
      "presets": ["env"]
      "modules": "common",
      "comments": true
    }
  }
}

API

const Metalsmith = require('metalsmith');
const babel = require('metalsmith-babel');

const babelOptions = {
  presets: ['env']
};

new Metalsmith('./source')
.use(babel(babelOptions))
.build((err, files) => {
  if (err) {
    throw err;
  }

  console.log('Completed.');
});

Options

All Babel options are available except for filename, filenameRelative and sourceMapTarget that will be automatically set.

License

ISC License © 2017 Shinnosuke Watanabe

About

Metalsmith plugin for Babel

License:ISC License


Languages

Language:JavaScript 100.0%