Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulp: Gulpfile with Bower and Bootstrap
// 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
You can’t perform that action at this time.