Skip to content

Instantly share code, notes, and snippets.

@stefthoen
Created March 17, 2014 11:21
Show Gist options
  • Select an option

  • Save stefthoen/9597605 to your computer and use it in GitHub Desktop.

Select an option

Save stefthoen/9597605 to your computer and use it in GitHub Desktop.
/*
* TODO:
* Banner
* Grunt icon
*/
var gulp = require('gulp'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
refresh = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
gulp.task('templates', function() {
gulp.src(['*.html', '*.php'])
.pipe(refresh(server))
.pipe(notify({ message: 'Template task complete' }))
});
gulp.task('scss', function() {
gulp.src('_/scss/*.scss')
.pipe(sass())
.pipe(autoprefixer('last 2 versions', 'ie 9', 'ios 6', 'android 4'))
.pipe(minifycss({ keepSpecialComments: 1 }))
.pipe(gulp.dest('.'))
.pipe(refresh(server))
.pipe(notify({ message: 'SCSS task complete' }))
});
gulp.task('lint', function() {
gulp.src('_/js/src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(notify({ message: 'Lint task complete' }))
});
gulp.task('js', function() {
gulp.src(['_/js/lib/jquery/dist/jquery.js', '_/js/src/*.js'])
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(gulp.dest('_/js'))
.pipe(refresh(server))
.pipe(notify({ message: 'JS task complete' }))
});
gulp.task('watch', function() {
server.listen(35729, function(err) {
if (err) {
return console.log(err)
}
gulp.watch(['_/scss/**/*.scss', '_/scss/*.scss'], ['scss']);
gulp.watch(['_/js/src/*.js'], ['lint', 'js']);
gulp.watch(['*.html', '*.php'], ['templates']);
})
});
gulp.task('default', ['templates', 'scss', 'lint', 'js', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment