Skip to content

Instantly share code, notes, and snippets.

@yocontra
Last active April 3, 2017 02:43
Show Gist options
  • Save yocontra/5924386 to your computer and use it in GitHub Desktop.
Save yocontra/5924386 to your computer and use it in GitHub Desktop.
Ideal build system
gulp = require 'gulp'
clean = require 'gulp-clean'
jade = require 'gulp-jade'
coffee = require 'gulp-coffee'
minify = require 'gulp-minify'
###
quick syntax ideas:
gulp.files() takes a glob and is an array of file streams
gulp.folder() is like gulp.files("./folder/**/*") but it maintains directory structure
you can pipe a .folder() or a .files() to another .folder()
.files() and .folder() both take an options argument:
"ignore" is an array which should follow the same syntax and behaviour as a .gitignore file
###
# wipe the public folder
gulp.folder("./public").pipe(clean)
# compile, minify, and copy templates
gulp.folder("./client/templates")
.pipe(jade)
.pipe(minify)
.pipe(gulp.folder("./public/templates"))
# compile, minify, and copy all coffee-script
gulp.folder("./client/js", {ignore:["vendor"]})
.pipe(coffee)
.pipe(minify)
.pipe(gulp.folder("./public/js"))
# minify and copy all vendor files
gulp.folder("./client/js/vendor")
.pipe(minify)
.pipe(gulp.folder("./public/js/vendor"))
# copy static files
gulp.folder("./client/img")
.pipe(gulp.folder("./public/img"))
gulp.folder("./client/css")
.pipe(gulp.folder("./public/css"))
gulp.files("./client/*.html")
.pipe(gulp.folder("./public"))
gulp.files("./client/*.ico")
.pipe(gulp.folder("./public"))
@yocontra
Copy link
Author

yocontra commented Jul 4, 2013

@nrn - That might be a case where you wouldn't even need groan - just rimraf("./public")

FYI the name has been changed to gulp since groan is taken. It gulps up your files... i know.

@nrn
Copy link

nrn commented Jul 4, 2013

Good point.

lol, nice....

@yocontra
Copy link
Author

yocontra commented Jul 4, 2013

Repo created https://github.com/wearefractal/gulp

Move all further discussion to gulpjs/gulp#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment