-
-
Save nelsonomuto/08c139d86ffa1e7a08333b1f5f1f740d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'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