Created by Simeon Smith.
A plugin for 11ty to compile JS with gulp-babel.
Available on npm.
npm i -D eleventy-plugin-babel
Open up your Eleventy config file (probably eleventy.js
) and use addPlugin:
const pluginBabel = require('eleventy-plugin-js');
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginBabel, babelPluginOptions);
};
Read more about Eleventy plugins.
Key | Type | Default | Description |
---|---|---|---|
watch | glob or array of globs | ['**/*.js', '!node_modules/**'] |
The JS files or matches of the files you wish to compile (and watch when you serve). |
uglify | boolean | false |
If you wish your JS code to be uglified using babel-uglify |
outputDir | String | "dist/js" |
The directory where the compiled JS will output. |
sourceMaps | Boolean | false |
If you'd liked to output sourcemaps using gulp-sourcemaps |
babel | gulp-babel options | { presets: ['@babel/env'] } |
Options that are passed to gulp-babel. See gulp-babel for options. |
Feel free to create issues with suggestions, bugs or open pull requests with changes.
MIT © Simeon Smith.