metalsmith-babel

5.1.0 • Public • Published

metalsmith-babel

npm version 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": ["@babel/preset-env"]
    }
  }
}

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/core options are available except for filename and filenameRelative that will be automatically set.

License

ISC License © 2017 - 2018 Shinnosuke Watanabe

Package Sidebar

Install

npm i metalsmith-babel

Weekly Downloads

11

Version

5.1.0

License

ISC

Unpacked Size

6.24 kB

Total Files

4

Last publish

Collaborators

  • sebmck
  • shinnn