Last active
September 30, 2015 13:17
-
-
Save AtsushiSuzuki/c9e45e2b4ff90042bbe3 to your computer and use it in GitHub Desktop.
Gulpfile recipe for gulp-less with gulp.watch
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'); | |
var less = require('gulp-less'); | |
var plumber = require('gulp-plumber'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var lesses = ['src/less/**/*.less']; | |
gulp.task('less', function () { | |
return gulp.src(lesses) | |
.pipe(sourcemaps.init()) | |
.pipe(plumber()) | |
.pipe(less({ | |
paths: [__dirname + '/node_modules/bootstrap/less'] | |
})) | |
.on('error', function (err) { | |
console.error(err.toString()); | |
this.emit('end'); | |
}) | |
.pipe(sourcemaps.write('.', {sourceRoot: '.'})) | |
.pipe(gulp.dest('public/css')); | |
}); | |
gulp.task('watch', function () { | |
gulp.watch(lesses, function () { | |
gulp.start(['less']); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment