better-babel-cli
A better babel command-line utility
Last updated 2 years ago by ksherlock .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install better-babel-cli -g
SYNC missed versions from official npm registry.

Better Babel CLI

The babel 6 cli is actively user hostile. They "encourage" you to install it locally for every project. Installing it globally is a waste of time.

Did I mention a local install of babel-cli and nothing else takes up 39 Megabytes? And that doesn't even include any of the plugins that actually make babel useful. Why is that acceptable to anyone?

This is a replacement which includes all the plugins, is global happy, works great on the command-line and in makefiles, doesn't require .babelrc files to configure, and somehow only takes up 20 Megabytes (which is still excessive but that's node for you.)

Install

[sudo] npm uninstall -g babel-cli
[sudo] npm install -g better-babel-cli

Example

You can either run it on the command line or put it in your makefile.

Makefile:

out/%.js : src/%.jsx
    babel --react --es2015 --object-rest-spread -o $@ -- $< 

out/%.js : src/%.js
    babel --es2015 -o $@ -- $< 

Commandline:

babel --verbose --es2015 --stage-0
(reads stdin, writes to stdout)

Use --preset or --plugin to enable transformations. You can also use --no-plugin to disable a plugin (if it was part of a preset, for example.). --foo and --transform-foo are equivalent to require(babel-plugin-transform-foo).

run babel --help, babel --help-presets, or babel --help-plugins to see a list of presets and plugins.

Configuration

Some plugins allow configuration options. Run babel --help-config for details. These may be specified as optional sub-arguments on the command-line.

For example:

babel --transform-es2015-template-literals loose=true,spec=false
babel --transform-es2015-template-literals loose,spec=false

loose is equivalent to loose=true. --loose and --spec set the loose and spec properties, respectively, for all plugins.

--transform-es2015-modules-umd is a special case. This .babelrc

{
  "plugins": [
    ["transform-es2015-modules-umd", {
      "globals": {
        "es6-promise": "Promise"
      }
    }]
  ]
}

is handled as:

babel --transform-es2015-modules-umd es6-promise=Promise,...

Current Tags

  • 1.2.3                                ...           latest (2 years ago)

8 Versions

  • 1.2.3                                ...           2 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (114)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |