{"id":7886,"date":"2015-11-05T00:06:08","date_gmt":"2015-11-05T00:06:08","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/05\/gulpjs-gulp\/"},"modified":"2015-11-05T00:06:08","modified_gmt":"2015-11-05T00:06:08","slug":"gulpjs-gulp","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/05\/gulpjs-gulp\/","title":{"rendered":"gulpjs\/gulp"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/raw.githubusercontent.com\/gulpjs\/artwork\/master\/gulp-2x.png\" \/><\/p>\n<p><strong>The streaming build system<\/strong><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.shields.io\/npm\/v\/gulp.svg\" \/> <img decoding=\"async\" src=\"http:\/\/img.shields.io\/npm\/dm\/gulp.svg\" \/> <img decoding=\"async\" src=\"http:\/\/img.shields.io\/gittip\/WeAreFractal.svg\" \/> <img decoding=\"async\" src=\"http:\/\/img.shields.io\/travis\/gulpjs\/gulp.svg\" \/> <img decoding=\"async\" src=\"http:\/\/img.shields.io\/coveralls\/gulpjs\/gulp\/master.svg\" \/> <img decoding=\"async\" src=\"http:\/\/badges.gitter.im\/gulpjs\/gulp.png\" \/><\/p>\n<h2>Like what we do?<\/h2>\n<p>Support us via Gratipay<\/p>\n<h2>Documentation<\/h2>\n<p>For a Getting started guide, API docs, recipes, making a plugin, etc. see the documentation page!<\/p>\n<h2>Sample <code>gulpfile.js<\/code><\/h2>\n<p>This file is just a quick sample to give you a taste of what gulp does.<\/p>\n<pre><code>var gulp = require('gulp');\nvar coffee = require('gulp-coffee');\nvar concat = require('gulp-concat');\nvar uglify = require('gulp-uglify');\nvar imagemin = require('gulp-imagemin');\nvar sourcemaps = require('gulp-sourcemaps');\nvar del = require('del');\n\nvar paths = {\n  scripts: ['client\/js\/**\/*.coffee', '!client\/external\/**\/*.coffee'],\n  images: 'client\/img\/**\/*'\n};\n\n\/\/ Not all tasks need to use streams\n\/\/ A gulpfile is just another node program and you can use all packages available on npm\ngulp.task('clean', function(cb) {\n  \/\/ You can use multiple globbing patterns as you would with `gulp.src`\n  del(['build'], cb);\n});\n\ngulp.task('scripts', ['clean'], function() {\n  \/\/ Minify and copy all JavaScript (except vendor scripts)\n  \/\/ with sourcemaps all the way down\n  return gulp.src(paths.scripts)\n    .pipe(sourcemaps.init())\n      .pipe(coffee())\n      .pipe(uglify())\n      .pipe(concat('all.min.js'))\n    .pipe(sourcemaps.write())\n    .pipe(gulp.dest('build\/js'));\n});\n\n\/\/ Copy all static images\ngulp.task('images', ['clean'], function() {\n  return gulp.src(paths.images)\n    \/\/ Pass in options to the task\n    .pipe(imagemin({optimizationLevel: 5}))\n    .pipe(gulp.dest('build\/img'));\n});\n\n\/\/ Rerun the task when a file changes\ngulp.task('watch', function() {\n  gulp.watch(paths.scripts, ['scripts']);\n  gulp.watch(paths.images, ['images']);\n});\n\n\/\/ The default task (called when you run `gulp` from cli)\ngulp.task('default', ['watch', 'scripts', 'images']);\n<\/code><\/pre>\n<h2>Incremental Builds<\/h2>\n<p>We recommend these plugins:<\/p>\n<ul>\n<li>gulp-changed &#8211; only pass through changed files<\/li>\n<li>gulp-cached &#8211; in-memory file cache, not for operation on sets of files<\/li>\n<li>gulp-remember &#8211; pairs nicely with gulp-cached<\/li>\n<li>gulp-newer &#8211; pass through newer source files only, supports many:1 source:dest<\/li>\n<\/ul>\n<h2>Want to contribute?<\/h2>\n<p>Anyone can help make this project better &#8211; check out the Contributing guide!<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/d2weczhvl823v0.cloudfront.net\/wearefractal\/gulp\/trend.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The streaming build system Like what we do? Support us via Gratipay Documentation For a Getting started guide, API docs, recipes, making a plugin, etc. see the documentation page! Sample gulpfile.js This file is just a quick sample to give you a taste of what gulp does. var gulp = require(&#8216;gulp&#8217;); var coffee = require(&#8216;gulp-coffee&#8217;); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7886","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7886"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7886\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}