I am using less and Grunt, and am moving to gulp.
My less works. When I run:
lessc public/less/myapp.less
I get working output with no errors. All my less, including includes, is in public/less, BTW. Here is my gulpfile:
var gulp = require('gulp');
var prefixer = require('gulp-autoprefixer');
var less = require('gulp-less');
gulp.task('compileLess', function () {
gulp
.src('./public/less/*')
.pipe(less({
paths: ['./public/less'], // Search paths for imports
filename: 'myapp.less'
}))
.pipe(gulp.dest('./public/css'));
});
// The default task (called when you run `gulp`)
gulp.task('default', function() {
gulp.run('compileLess');
// Watch files and run tasks if they change
gulp.watch('./public/less/*.less', function(event) {
gulp.run('less');
});
});
When I run gulp, I get:
~/Documents/myapp: gulp
[gulp] Using file /Users/me/Documents/myapp/gulpfile.js
[gulp] Working directory changed to /Users/me/Documents/myapp
[gulp] Running 'default'...
[gulp] Running 'compileLess'...
[gulp] Finished 'compileLess' in 11 ms
[gulp] Finished 'default' in 41 ms
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: variable @brightblue is undefined
@brightblue is defined, in a file imported at the start of myapp.less.
@import "./colors.less";
body {
background-color: @brightblue;
}
- Why isn't gulp picking up my includes? Specifying 'paths' option for less should make it work, but it isn't fixing it.
- What's a good way to debug this? I don't have a line number, for example.
- Is there a way to make gulp work?