Created
July 13, 2014 05:07
-
-
Save aaronfischer/7dcc41736e67ecaf0b0b to your computer and use it in GitHub Desktop.
Gulp File - *working document*
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
var gulp = require('gulp'), | |
// sass = require('gulp-ruby-sass'), | |
compass = require('gulp-compass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
minifycss = require('gulp-minify-css'), | |
jshint = require('gulp-jshint'), | |
uglify = require('gulp-uglify'), | |
imagemin = require('gulp-imagemin'), | |
pngcrush = require('imagemin-pngcrush'), | |
rename = require('gulp-rename'), | |
clean = require('gulp-clean'), | |
concat = require('gulp-concat'), | |
notify = require('gulp-notify'), | |
cache = require('gulp-cache'), | |
livereload = require('gulp-livereload'); | |
gulp.task('styles', function() { | |
return gulp.src('assets/scss/style.scss') | |
// .pipe(sass({ style: 'expanded' })) | |
.pipe(compass({ config_file: 'config.rb', css: 'assets/css', sass: 'assets/scss' })) | |
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) | |
.pipe(gulp.dest('assets/css')) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(minifycss()) | |
.pipe(gulp.dest('assets/css')) | |
.pipe(notify({ message: 'Styles task complete' })); | |
}); | |
gulp.task('scripts', function() { | |
return gulp.src(['assets/js/plugins.js', 'assets/js/vendor/*.js']) | |
// .pipe(jshint('.jshintrc')) | |
// .pipe(jshint.reporter('default')) | |
.pipe(concat('plugins.js')) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(gulp.dest('assets/js')) | |
.pipe(uglify()) | |
.pipe(gulp.dest('assets/js')) | |
.pipe(notify({ message: 'Scripts task complete' })); | |
}); | |
gulp.task('images', function() { | |
return gulp.src('assets/media/img/**/*') | |
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))) | |
.pipe(gulp.dest('assets/media/img')) | |
.pipe(notify({ message: 'Images task complete' })); | |
}); | |
// gulp.task('clean', function() { | |
// return gulp.src(['assets/css', 'assets/js', 'assets/media/img'], {read: false}) | |
// .pipe(clean()); | |
// }); | |
gulp.task('default', function() { | |
gulp.start('styles', 'scripts', 'images'); | |
}); | |
gulp.task('watch', function() { | |
// Watch .scss files | |
gulp.watch('assets/scss/**/*.scss', ['styles']); | |
// Watch .js files | |
gulp.watch('assets/js/**/*.js', ['scripts']); | |
// Watch image files | |
gulp.watch('assets/media/img/**/*', ['images']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment