Last active
January 4, 2016 12:59
-
-
Save joe-watkins/8625098 to your computer and use it in GitHub Desktop.
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-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
minifycss = require('gulp-minify-css'), | |
rename = require('gulp-rename'), | |
notify = require('gulp-notify'), | |
appDefaults = { | |
stylesDir : "styles/" // define path to styles | |
} | |
// Styles | |
gulp.task('styles', function() { | |
return gulp.src(appDefaults.stylesDir+'**/*.scss') | |
.pipe(sass({ style: 'compressed' })) | |
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) | |
.pipe(gulp.dest(appDefaults.stylesDir)) | |
.pipe(rename({ suffix: '.min' })) | |
.pipe(minifycss()) | |
.pipe(gulp.dest(appDefaults.stylesDir)) | |
.pipe(notify({ message: 'Styles task complete' })); | |
}); | |
// Watch | |
gulp.task('watch', function() { | |
// Watch .scss files | |
gulp.watch(appDefaults.stylesDir+'**/*.scss', function(event) { | |
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); | |
gulp.run('styles'); | |
}); | |
}); | |
// Default task | |
gulp.task('default', function() { | |
}); |
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
{ | |
"name": "gulp-sass-starter", | |
"version": "0.0.0", | |
"dependencies": {}, | |
"devDependencies": { | |
"gulp": "~3.4.0", | |
"gulp-rename": "~0.2.2", | |
"gulp-minify-css": "~0.2.0", | |
"gulp-notify": "~0.3.0", | |
"gulp-autoprefixer": "0.0.4", | |
"gulp-sass": "~0.6.0" | |
}, | |
"engines": { | |
"node": ">=0.8.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment