Created
January 22, 2014 20:02
-
-
Save richardegil/8566296 to your computer and use it in GitHub Desktop.
First Gulpfile
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
var gulp = require("gulp"); | |
var minifycss = require('gulp-minify-css'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var notify = require('gulp-notify'); | |
var sass = require('gulp-ruby-sass'); | |
var imagemin = require('gulp-imagemin'); | |
var cache = require('gulp-cache'); | |
gulp.task('css', function() { | |
return gulp.src('sass/style.scss') | |
.pipe(sass({ style: 'expanded', loadPath: ['sass/partials'] })) | |
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) | |
.pipe(gulp.dest('css/build/prefixed/')) | |
.pipe(minifycss()) | |
.pipe(gulp.dest('css/build/minified/')) | |
.pipe(notify({ message: 'CSS task complete' })); | |
}); | |
gulp.task('images', function() { | |
return gulp.src('images/**/*') | |
.pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true }))) | |
.pipe(gulp.dest('images/')) | |
.pipe(notify({ message: 'Images task complete' })); | |
}); | |
gulp.task('default', function() { | |
gulp.run('css', 'images'); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch('sass/**/*.scss', function() { | |
gulp.run('css'); | |
}); | |
gulp.watch('images/**/*', function() { | |
gulp.run('images'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment