Skip to content

Instantly share code, notes, and snippets.

@richardegil
Created January 22, 2014 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardegil/8566296 to your computer and use it in GitHub Desktop.
Save richardegil/8566296 to your computer and use it in GitHub Desktop.
First Gulpfile
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