Skip to content

Instantly share code, notes, and snippets.

@nelsonomuto
Last active December 28, 2016 14:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nelsonomuto/08c139d86ffa1e7a08333b1f5f1f740d to your computer and use it in GitHub Desktop.
Save nelsonomuto/08c139d86ffa1e7a08333b1f5f1f740d to your computer and use it in GitHub Desktop.
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
var notify = require('gulp-notify');
var less = require('gulp-less');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var exec = require('child_process').exec;
gulp.task('lite-server', function (cb) {
exec('npm run lite', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('css', function () {
return gulp.src(['./less/main.less'])
.pipe(less({ style: 'compressed' }).on('error', gutil.log))
.pipe(autoprefix())
.pipe(gulp.dest('./'))
.pipe(browserSync.stream())
.pipe(notify('css minified'));
});
gulp.task('watch', function () {
function reportChange(event){
console.log('Event type: ' + event.type); // added, changed, or deleted
console.log('Event path: ' + event.path); // The path of the modified file
}
gulp.watch('./less/**/**.less', ['css']).on('change', reportChange);
});
gulp.task('dev', ['css', 'watch', 'lite-server']);
gulp.task('default', ['dev']);
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment