Skip to content

Instantly share code, notes, and snippets.

@matthewrwilton
Last active August 29, 2015 14:21
Show Gist options
  • Save matthewrwilton/7b5d019bcf0f9ed5940a to your computer and use it in GitHub Desktop.
Save matthewrwilton/7b5d019bcf0f9ed5940a to your computer and use it in GitHub Desktop.
Basic gulpfile.js setup with a task to compile LESS to CSS and a task to watch for changes to LESS files and recompile.
var gulp = require("gulp"),
gulpWatch = require("gulp-watch"),
less = require("gulp-less"),
sourcemaps = require("gulp-sourcemaps");
gulp.task("less", function () {
return gulp.src("./Content/Less/Site.less")
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write("../Content"))
.pipe(gulp.dest("./Content"));
});
gulp.task("watch", function () {
gulpWatch(["./Content/Less/*.less"], function () { gulp.start("less") });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment