restructure readme

This commit is contained in:
Sebastian McKenzie 2014-09-29 00:25:24 +10:00
parent 66e06b5e13
commit 30453aa3b1

View File

@ -2,12 +2,10 @@
**6to5** turns ES6 code into vanilla ES5, so you can use ES6 features **today.** **6to5** turns ES6 code into vanilla ES5, so you can use ES6 features **today.**
6to5 is:
- Fast - [10x faster than Traceur](#comparison-to-traceur). - Fast - [10x faster than Traceur](#comparison-to-traceur).
- Compact - maps directly to the equivalent ES5. - Compact - maps directly to the equivalent ES5.
- Easy - with Browserify support, Node API, Connect Middleware and a CLI. - Easy - with Browserify support, Node API, Connect Middleware and a CLI.
- Concise - we do not pollute any scope with unneccesary variables or functions declarations. - Concise - does not pollute scope with unneccesary variables.
## Features ## Features
@ -45,6 +43,10 @@ Compile the file `script.js` and output it to stdout.
$ 6to5 script.js $ 6to5 script.js
### Browserify
$ browserify script.js -t 6to5/browserify --outfile bundle.js
### Node ### Node
```javascript ```javascript
@ -64,11 +66,12 @@ to5.transformFile("script.js", function (err, data) {
```javascript ```javascript
to5.transform("code();", { to5.transform("code();", {
// List of transformers to EXCLUDE // List of transformers to EXCLUDE
// See `features` for valid names. // This is a camelised version of the name found in `features`
// eg. "arrow functions" is "arrowFunctions"
blacklist: [], blacklist: [],
// List of transformers to ONLY use. // List of transformers to ONLY use.
// See `features` for valid names. // See `blacklist` for naming scheme.
whitelist: [], whitelist: [],
// Append source map and comment to bottom of returned output. // Append source map and comment to bottom of returned output.
@ -97,7 +100,7 @@ require("6to5/register");
```javascript ```javascript
var to5 = require("6to5"); var to5 = require("6to5");
app.use(6to5.middleware({ app.use(to5.middleware({
transform: { transform: {
// options to use when transforming files // options to use when transforming files
}, },
@ -108,13 +111,7 @@ app.use(6to5.middleware({
app.use(connect.static("cache")); app.use(connect.static("cache"));
``` ```
### Browserify #### Browserify
#### CLI
$ browserify script.js -t 6to5/browserify --outfile bundle.js
#### Node
```javascript ```javascript
var to5 = require("6to5"); var to5 = require("6to5");