我在我的 gulpfile.js 中尝试了这个:
gulp.task('buildStyles', function() {
return gulp.src([
'./styles/less/main.less',
'./styles/less/widgets/widgets.less',
'./styles/less/pages/pages.less',
'./styles/less/themes/default.less',
'./styles/less/rtl/rtl.less'
])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat('allmin.css'))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./dest'));
});
但我总是收到这样的消息:
$ gulp buildStyles
[18:46:31] Using gulpfile /Library/WebServer/Documents/qjt2015/trunk/gulpfile.js
[18:46:31] Starting 'buildStyles'...
gulp-sourcemap-write: source file not found:/Library/WebServer/Documents/qjt2015/trunk/styles/less/support-tickets.less
gulp-sourcemap-write: source file not found:/Library/WebServer/Documents/qjt2015/trunk/styles/less/comments.less
gulp-sourcemap-write: source file not found:/Library/WebServer/Documents/qjt2015/trunk/styles/less/article-comments.less
gulp-sourcemap-write: source file not found:/Library/WebServer/Documents/qjt2015/trunk/styles/less/threads.less
gulp-sourcemap-write: source file not found:/Library/WebServer/Documents/qjt2015/trunk/styles/less/chat.less
我在所有较少的文件中使用@imports,并且引用是那些在消息中未找到的引用。例如,我的 widgets.less 文件如下:
// ### Bootstrap's variables andmixins
@import "../../../bower_components/bootstrap/less/variables.less";
@import "../../../bower_components/bootstrap/less/mixins.less";
@import '../variables.less';
@import '../mixins.less';
@import './support-tickets.less';
@import './comments.less';
@import './article-comments.less';
@import './threads.less';
@import './chat.less';
我错过了什么吗?在此先感谢您的帮助!