babel/doc/index.md
2014-11-24 00:35:39 +11:00

2.4 KiB

6to5 turns ES6+ code into vanilla ES5, so you can use next generation features today.

  • Readable - formatting is retained if possible so your generated code is as similar as possible.
  • Extensible - with a large range of plugins and browser support.
  • Lossless - source map support so you can debug your compiled code with ease.
  • Compact - maps directly to the equivalent ES5 with no runtime*.

Installation

It's as easy as:

$ npm install -g 6to5

Usage

Once you've installed 6to5, there are multiple paths you can take depending on how you want to use it.

6to5 will simply compile your ES6+ script to ES5 if you pass it as an argument to the command-line tool 6to5:

$ 6to5 script.js

If you have a file written using ES6+ and you just want to run it, 6to5-node has you covered:

$ 6to5-node script.js

And it doesn't end here! To see all the ways you can use 6to5, check out the Usage page.

Features