Created
August 6, 2014 17:36
-
-
Save vienhoang/4289233d9df719af5cb0 to your computer and use it in GitHub Desktop.
Gulp: Gulpfile with Bower and Bootstrap
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
// Include gulp | |
var gulp = require('gulp'); | |
// Include Our Plugins | |
var jshint = require('gulp-jshint'); | |
var sass = require('gulp-sass'); | |
var concat = require('gulp-concat'); | |
var uglify = require('gulp-uglify'); | |
var rename = require('gulp-rename'); | |
// Lint Task | |
gulp.task('lint', function() { | |
return gulp.src('_assets/components/js/*.js') | |
.pipe(jshint()) | |
.pipe(jshint.reporter('default')); | |
}); | |
// Compile Our Sass | |
gulp.task('sass', function() { | |
return gulp.src('_assets/components/scss/*.scss') | |
.pipe(sass()) | |
.pipe(gulp.dest('_assets/css')); | |
}); | |
// Concatenate & Minify JS | |
gulp.task('scripts', function() { | |
return gulp.src([ | |
'./bower_components/jquery/dist/jquery.js', | |
'./bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js', | |
'_assets/components/js/*.js']) | |
.pipe(concat('all.js')) | |
.pipe(gulp.dest('_assets/js')) | |
.pipe(rename('all.min.js')) | |
.pipe(uglify()) | |
.pipe(gulp.dest('_assets/js')); | |
}); | |
// Watch Files For Changes | |
gulp.task('watch', function() { | |
gulp.watch('_assets/components/js/*.js', ['lint', 'scripts']); | |
gulp.watch('_assets/components/scss/*.scss', ['sass']); | |
}); | |
// Default Task | |
gulp.task('default', ['lint', 'sass', 'scripts', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment