// Load Gulp var gulp = require('gulp'), gutil = require('gulp-util'), plugins = require('gulp-load-plugins')({ rename: { 'gulp-live-server': 'serve' } }); // Start Watching: Run "gulp" gulp.task('default', ['watch']); // Run "gulp server" gulp.task('server', ['serve', 'watch']); // WooCommerce integration gulp.task('plugins-integration-css', function() { return gulp.src('dev/plugins-integration/*.less') .pipe(plugins.plumber()) .pipe(plugins.less()) .pipe(gulp.dest('assets/plugins-integration')) }); // Minify Custom JS: Run manually with: "gulp build-js" gulp.task('build-js', function () { return gulp.src('dev/js/*.js') .pipe(plugins.jshint()) .pipe(plugins.jshint.reporter('jshint-stylish')) .pipe(plugins.uglify({ output: { 'ascii_only': true } })) .pipe(plugins.concat('main.min.js')) .pipe(gulp.dest('assets/js')); }); // Less to CSS: Run manually with: "gulp build-css" gulp.task('build-css', function () { return gulp.src('dev/*.less') .pipe(plugins.plumber()) .pipe(plugins.less()) .pipe(gulp.dest('./assets/css')).on('error', gutil.log); }); // Default task gulp.task('watch', function () { gulp.watch('dev/jquery-plugins/*.js'); gulp.watch('dev/js/*.js', ['build-js']); gulp.watch(['dev/theme/*.less', 'dev/*.less'], ['build-css']); gulp.watch(['dev/plugins-integration/**/*.less','dev/plugins-integration/*.less'], ['plugins-integration-css']); }); // Folder "/" serving at http://localhost:8888 // Should use Livereload (http://livereload.com/extensions/) gulp.task('serve', function () { var server = plugins.serve.static('/', 8888); server.start(); gulp.watch(['assets/*'], function (file) { server.notify.apply(server, [file]); }); });