motion
Version:
motion - moving development forward
106 lines (78 loc) • 3.61 kB
Markdown
<p align="center">
<a href="http://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>
**The streaming build system**
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Support us][gittip-image]][gittip-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
[ ](https://gratipay.com/WeAreFractal/)
For a Getting started guide, API docs, recipes, making a plugin, etc. see the [documentation page](/docs/README.md)!
This file is just a quick sample to give you a taste of what gulp does.
```js
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var sourcemaps = require('gulp-sourcemaps');
var del = require('del');
var paths = {
scripts: ['client/js/**/*.coffee', '!client/external/**/*.coffee'],
images: 'client/img/**/*'
};
// Not all tasks need to use streams
// A gulpfile is just another node program and you can use all packages available on npm
gulp.task('clean', function(cb) {
// You can use multiple globbing patterns as you would with `gulp.src`
del(['build'], cb);
});
gulp.task('scripts', ['clean'], function() {
// Minify and copy all JavaScript (except vendor scripts)
// with sourcemaps all the way down
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(coffee())
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/js'));
});
// Copy all static images
gulp.task('images', ['clean'], function() {
return gulp.src(paths.images)
// Pass in options to the task
.pipe(imagemin({optimizationLevel: 5}))
.pipe(gulp.dest('build/img'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['watch', 'scripts', 'images']);
```
We recommend these plugins:
- [gulp-changed](https://github.com/sindresorhus/gulp-changed) - only pass through changed files
- [gulp-cached](https://github.com/wearefractal/gulp-cached) - in-memory file cache, not for operation on sets of files
- [gulp-remember](https://github.com/ahaurw01/gulp-remember) - pairs nicely with gulp-cached
- [gulp-newer](https://github.com/tschaub/gulp-newer) - pass through newer source files only, supports many:1 source:dest
Anyone can help make this project better - check out the [Contributing guide](/CONTRIBUTING.md)!
[](https://bitdeli.com/free "Bitdeli Badge")
[ ]: https://www.gittip.com/WeAreFractal/
[ ]: http://img.shields.io/gittip/WeAreFractal.svg
[ ]: http://img.shields.io/npm/dm/gulp.svg
[ ]: https://npmjs.org/package/gulp
[ ]: http://img.shields.io/npm/v/gulp.svg
[ ]: https://travis-ci.org/gulpjs/gulp
[ ]: http://img.shields.io/travis/gulpjs/gulp.svg
[ ]: https://coveralls.io/r/gulpjs/gulp
[ ]: http://img.shields.io/coveralls/gulpjs/gulp/master.svg
[ ]: https://gitter.im/gulpjs/gulp
[ ]: https://badges.gitter.im/gulpjs/gulp.png