-
-
Save yocontra/5924386 to your computer and use it in GitHub Desktop.
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")) |
+1 I really like the idea of modules implementing pipes, but also have some concern for staying idiomatic
@terinjokes - I'm not sure removing the pipe is a good idea... I do like the idea of a simplified task system. It should just be as easy as assigning a function to a name. Grunt's task system is insanely over-complex. Having a simple task system also lets you break up your code like this
# executed when running `groan buildmyshit` or if another task chooses to run it
groan.task('buildmyshit', function(){
# do stuff
groan.folder("./client/js", {ignore:["vendor"]})
.pipe(coffee)
.pipe(minify)
.pipe(groan.folder("./public/js"))
});
# executed when running `groan moveshit or if another task chooses to run it
groan.task('moveshit', function(){
# do stuff
groan.folder("./client/img")
.pipe(groan.folder("./public/img"))
groan.folder("./client/css")
.pipe(groan.folder("./public/css"))
groan.files("./client/*.html")
.pipe(groan.folder("./public"))
groan.files("./client/*.ico")
.pipe(groan.folder("./public"))
});
# executed when just running `groan`
groan.task('default', function(){
groan.run('buildmyshit', 'moveshit');
});
Any task should be able to .run() other tasks which lets you do some interesting things and maintain a clean build file
I really like this dude. It's a build system that I wouldn't feel bad using at run time in production.
Though i'm pretty sure
# wipe the public folder
groan.folder("./public").pipe(clean)
should be
# wipe the public folder
clean.pipe(groan.folder("./public"))
@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.
Good point.
lol, nice....
Repo created https://github.com/wearefractal/gulp
Move all further discussion to gulpjs/gulp#1
Looks great.
Was thinking it would be great if the modules implemented pipe, so you could do:
That way we limit the amount of visual noise we add to the configuration file. On the other hand, I could see how this deviates, a little, from standard node.
The only other thing I can think of wanted to add is a way to export these so the can be invoked from the command line. Perhaps something like:
Or maybe event a terminating function such as
.named('burntcoffee')
? I like the latter idea, but would be open to the former or others