fait-babel

<h1 align="center"> <img alt="fait×babel" height="75" src="logo.png"> </h1> <h4 align="center">make target for babel compilation</h4>

Usage no npm install needed!

<script type="module">
  import faitBabel from 'https://cdn.skypack.dev/fait-babel';
</script>

README

fait×babel

make target for babel compilation

installation

fait-babel requires fait. Install them both with:

npm install --save-dev fait fait-babel

fait will create a barebones makefile: to load fait-babel, add:

$(call require, fait-babel)

Usage

Run make babel to compile Javascript files from src into lib. fait-babel uses .babelrc your current working directory (and creates an skeleton .babelrc if you don't have one).

To add plugins or presets, run make babel-install-plugins plugins+=plugin presets+=preset, where plugin and preset are the names of what you want to install (minus the leading babel-preset- or babel-plugin-). You can install multiple plugins or presets at once.

Documentation

Rules

📄 babel ⬅️ $(~babel-dst-files) 🔗

Default entry target.

📑 $(~babel-dst-files): $(babel-dst-dir)/% ⬅️ $(babel-src-dir)/% .babelrc 🔗

Compile all $(babel-src-dir) Javascript files to $(babel-dst-dir).

📃 babel-install-plugins 🔗

Install Babel plugins and write to .babelrc. Configured by the variables $(plugins) and $(presets), which you should pass on the command line.

If you want to e.g. install babel-preset-es2015 and babel-plugin-transform-runtime, the command would be make babel-install-plugins presets+=es2015 plugins+=transform-runtime.

If you install transform-runtime, babel-runtime is also installed.

Uses @quarterto/bae under the hood.

📃 babel-remove-plugins 🔗

Same as babel-install-plugins but uninstalls and removes things from .babelrc instead.

Variables

🚩 $(babel-src-dir) 🔗

Directory to look for source Javascript files (determined by $(babel-extensions)).

🚩 $(babel-dst-dir) 🔗

Directory to put compiled Javascript files.

🚩 $(babel-extensions) 🔗

Extensions that we consider "Javascript source files". .js and .jsx by default.

🚩 $(babel-opts) 🔗

Options to pass to Babel.

Licence

MIT