Last active
April 1, 2017 10:24
-
-
Save eristic/b3d5bf21979ac2878b34f2c33b79df02 to your computer and use it in GitHub Desktop.
Gulp file for HTML5 Boilerplate. Save out as gulpfile.js
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
// Doing pretty basic stuff here, but make sure you add these dependencies via terminal | |
var gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
concat = require('gulp-concat'), | |
minify = require('gulp-minify'); | |
// Need to create a /sass folder inside your css | |
gulp.task('build-that-css', function() { | |
return gulp.src('css/sass/*.scss') | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(concat('main.css')) | |
.pipe(gulp.dest('css/')); | |
}); | |
gulp.task('compress-that-js', function() { | |
gulp.src('js/*.js') | |
.pipe(minify({ | |
ext: { | |
src: 'main.js', | |
min: '.min.js' | |
} | |
})) | |
.pipe(gulp.dest('js/min/')) | |
// link to this minified version in your HTML | |
}); | |
// Gulp is watching you and your coding with the command: gulp watch | |
gulp.task('watch', function() { | |
gulp.watch('css/sass/*.scss', ['build-that-css']); | |
gulp.watch('js/*.js', ['compress-that-js']); | |
}); | |
gulp.task('default', ['watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Making a series of these for different frameworks. Feel free to give feedback, revisions, etc.