我使用less和Grunt,并且正在转移到吞噬。Gulp less不处理包括正确的,包含的变量未定义
我的作品较少。当我运行时:
lessc public/less/myapp.less
我得到工作输出没有错误。 我所有的少,包括包括,在公开/较少,顺便说一句。这里是我的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');
});
});
当我运行一饮而尽,我得到:
~/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定义,在myapp.less开始导入的文件。
@import "./colors.less";
body {
background-color: @brightblue;
}
- 为什么不吞下拿起我的包括?指定较少的'路径'选项应该使其工作,但它没有解决它。
- 什么是调试这个好方法?例如,我没有行号。
- 有没有一种方法可以使吞咽工作?
感谢您的支持。我遇到了同样的问题。我明白我做错了什么,但我不确定如何正确编排它。 +1 – welbornio