我在Windows上遇到路径问题。 在OSX上,它工作得很好。
这是我的任务:
gulp.task('build:less', function () {
return gulp.src('./src/less/style.less', {base: './src/less'})
.pipe(less({
paths: [path.join(__dirname, 'less', 'includes')]
}))
.pipe(rename(pkg.css))
.pipe(gulp.dest('./build/assets/'));
});
./ src / less / style.css内容
@import "../../vendor/bootstrap/less/bootstrap";
@import "../../vendor/bootstrap/less/glyphicons";
@import "../../vendor/font-awesome/less/font-awesome";
@import "../../vendor/material-design-iconic-font/less/material-design-iconic-font";
@import "../../vendor/bootstrap-select/less/bootstrap-select";
@import "../../vendor/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox";
@import "variables";
@import "navbar";
错误消息
C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0>call gulp build:less
[18:28:34] Using gulpfile C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0\gulpfile.js
[18:28:34] Starting 'build:less'...
C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0\node_modules\gulp-less\node_modules\accord\node_modules\when\lib\decorators\unhandledRejection.js:80
throw e;
^
Error: '../../vendor/bootstrap/less/bootstrap.less' wasn't found. Tried - C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0\vendor\bootstrap\less\bootstrap.less ,C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0\vendor\bootstrap\less\bootstrap.less,..\..\vendor\bootstrap\less\bootstrap.less in file C:\TeamCity\buildAgent\work\f6d8e60b97f3ac0\src\less\style.less line no. 1