A Metalsmith plugin to compile JavaScript with Babel
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
appveyor.yml
index.js
package-lock.json
package.json
test.js

README.md

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": ["@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