Last active
January 4, 2016 20:49
-
-
Save jeromecoupe/8676796 to your computer and use it in GitHub Desktop.
Simple gulpfile: do not use gulp.run > deprecated soon
This file contains 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
// Load plugins | |
var gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
jshint = require('gulp-jshint'), | |
uglify = require('gulp-uglify'), | |
rename = require('gulp-rename'), | |
concat = require('gulp-concat'), | |
notify = require('gulp-notify'), | |
minifycss = require('gulp-minify-css'); | |
// CSS task | |
gulp.task('css', function() { | |
return gulp.src('./www/scss/screen.scss') | |
.pipe(sass({ style: 'expanded', })) | |
.pipe(autoprefixer('last 3 version', 'safari 5', 'ie 8', 'ie 9')) | |
.pipe(gulp.dest('./www/css/')) | |
.pipe(rename({ suffix: '.min' })) | |
.pipe(minifycss()) | |
.pipe(gulp.dest('./www/css/')) | |
.pipe(notify({ message: 'Styles task complete' })); | |
}); | |
// Lint JS task | |
gulp.task('jslint', function() { | |
return gulp.src('./www/js/modules/*.js') | |
.pipe(jshint()) | |
.pipe(jshint.reporter('default')) | |
.pipe(notify({ message: 'Lint task complete' })); | |
}); | |
//Concatenate and Minify JS task | |
gulp.task('scripts', function() { | |
return gulp.src('./www/js/modules/*.js') | |
.pipe(concat('production.js')) | |
.pipe(gulp.dest('./www/js/build')) | |
.pipe(rename('production.min.js')) | |
.pipe(uglify()) | |
.pipe(gulp.dest('./www/js/build')) | |
.pipe(notify({ message: 'Scripts task complete' })); | |
}); | |
// Watch task | |
gulp.task('watch', function () { | |
gulp.watch('./www/scss/**', ['css']); | |
gulp.watch('./www/js/**', ['jslint', 'scripts']); | |
}); | |
//tasks | |
gulp.task('default', ['css', 'jslint', 'scripts']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment