Permalink
Browse files

Gulp dependencies and tasks

  • Loading branch information...
bueltge committed Apr 29, 2014
1 parent 8400f09 commit dfbb234ba4578cadbcb5494a6af03e8f810ed425
Showing with 17 additions and 16 deletions.
  1. +17 −16 gulpfile.js
View
@@ -4,6 +4,7 @@
*
* much helpful
* @see http://markgoodyear.com/2014/01/getting-started-with-gulp/
* @see http://mattbanks.me/gulp-wordpress-development/
*/
// Load plugins
@@ -23,65 +24,65 @@ var gulp = require('gulp'),
// Styles
gulp.task('styles', function() {
return gulp.src('src/styles/main.scss')
.pipe(sass({ style: 'expanded', }))
return gulp.src('assets/css/source/*.scss')
.pipe(sass({ style: 'expanded', compass: true }))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('dist/styles'))
.pipe(gulp.dest('assets/css/build'))
.pipe(rename({ suffix: '.min' }))
.pipe(minifycss())
.pipe(gulp.dest('dist/styles'))
.pipe(gulp.dest('assets/css'))
.pipe(notify({ message: 'Styles task complete' }));
});
// Scripts
gulp.task('scripts', function() {
return gulp.src('src/scripts/**/*.js')
return gulp.src('assets/js/source/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('main.js'))
.pipe(gulp.dest('dist/scripts'))
.pipe(gulp.dest('assets/js/build'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(gulp.dest('dist/scripts'))
.pipe(gulp.dest('assets/js'))
.pipe(notify({ message: 'Scripts task complete' }));
});
// Images
gulp.task('images', function() {
return gulp.src('src/images/**/*')
return gulp.src('assets/img/**/*')
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
.pipe(gulp.dest('dist/images'))
.pipe(gulp.dest('assets/img'))
.pipe(notify({ message: 'Images task complete' }));
});
// Clean
gulp.task('clean', function() {
return gulp.src(['dist/styles', 'dist/scripts', 'dist/images'], {read: false})
return gulp.src(['assets/css', 'assets/js', 'assets/img'], {read: false})
.pipe(clean());
});
// Default task
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'images');
gulp.start('css', 'js', 'img');
});
// Watch
gulp.task('watch', function() {
// Watch .scss files
gulp.watch('src/styles/**/*.scss', ['styles']);
gulp.watch('assets/css/*.scss', ['styles']);
// Watch .js files
gulp.watch('src/scripts/**/*.js', ['scripts']);
gulp.watch('assets/js/*.js', ['scripts']);
// Watch image files
gulp.watch('src/images/**/*', ['images']);
gulp.watch('assets/img/*', ['images']);
// Create LiveReload server
var server = livereload();
// Watch any files in dist/, reload on change
gulp.watch(['dist/**']).on('change', function(file) {
// Watch any files in assets/, reload on change
gulp.watch(['assets/**']).on('change', function(file) {
server.changed(file.path);
});

0 comments on commit dfbb234

Please sign in to comment.