Created
March 5, 2014 15:24
-
-
Save rmasters/9369382 to your computer and use it in GitHub Desktop.
Gulp is neato
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'), | |
less = require('gulp-less'), | |
clean = require('gulp-clean'), | |
coffee = require('gulp-coffee'), | |
uglify = require('gulp-uglify'), | |
concat = require('gulp-concat'); | |
var paths = { | |
styles: ['assets/styles/**/*.less'], | |
scripts: ['assets/scripts/**/*.coffee'] | |
}; | |
// Clean up build/generated files | |
gulp.task('clean', function() { | |
return gulp.src('build').pipe(clean()); | |
}); | |
// Compile all coffeescripts to javascript, minify and concatenate into a single | |
// file. | |
gulp.task('scripts', function() { | |
return gulp.src(paths.scripts) | |
.pipe(coffee()) | |
.pipe(uglify()) | |
.pipe(concat('hobo.min.js')) | |
.pipe(gulp.dest('build/js')); | |
}); | |
// Compile all less styles to CSS, minify and concatenate into a single file | |
gulp.task('styles', function() { | |
return gulp.src(paths.styles) | |
.pipe(less()) | |
.pipe(concat('hobo.min.css')) | |
.pipe(gulp.dest('build/css')); | |
}); | |
// Rebuild on change | |
gulp.task('watch', function() { | |
gulp.watch(paths.scripts, ['scripts']); | |
gulp.watch(paths.styles, ['styles']); | |
}); | |
// Run the whole shebang | |
gulp.task('default', ['clean', 'scripts', 'styles', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment