Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
azproduction committed Jul 23, 2014
1 parent 670758b commit bac355e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Expand Up @@ -45,6 +45,48 @@ See [Browsers format](https://github.com/ai/autoprefixer#browsers) for details.

## Examples

#### Basic

Steps:

- Concat all scripts
- Generate polyfills
- Append polyfills
- Uglify

```js
var gulp = require('gulp');
var concat = require('gulp-concat');
var order = require('gulp-order');
var uglify = require('gulp-uglify');
var autopolyfiller = require('gulp-autopolyfiller');
var merge = require('event-stream').merge;

gulp.task('default', function () {
// Concat all required js files
var all = gulp.src('js/*.js')
.pipe(concat('all.js'));

// Generate polyfills for all files
var polyfills = all
.pipe(autopolyfiller('polyfills.js'));

// Merge polyfills and all files streams
return merge(polyfills, all)
// Order files. NB! polyfills MUST be first
.pipe(order([
'polyfills.js',
'all.js'
]))
// Make single file
.pipe(concat('all.min.js'))
// Uglify it
.pipe(uglify())
// And finally write `all.min.js` into `build/` dir
.pipe(gulp.dest('build'));
});
```

#### Browsers targets

You can specify list of target browsers to reduce amount of polyfills.
Expand Down

0 comments on commit bac355e

Please sign in to comment.