在编译bootstrap时遇到这个错误:
./node_modules/.bin/gulp
[11:36:31] Using gulpfile ~/Desktop/elfet.github.io/gulpfile.js
[11:36:31] Starting 'default'...
[11:36:31] Finished 'default' after 21 ms
/Users/anton/Desktop/elfet.github.io/node_modules/gulp-less/node_modules/accord/node_modules/when/lib/decorators/unhandledRejection.js:80
throw e;
^
SyntaxError: Unexpected token u in file undefined line no. undefined
at Object.parse (native)
at /Users/anton/Desktop/elfet.github.io/node_modules/gulp-less/node_modules/accord/lib/adapters/less.js:48:32该怎么办呢?下面是我的gulpfile:
gulp.task('default', function () {
gulp.src('src/less/*.less')
.pipe(sourcemaps.init())
.pipe(less({
paths: [path.join(__dirname, 'less', 'includes')]
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('css'));
});发布于 2015-02-14 23:43:16
你在这里发布了同样的问题,https://github.com/less/less.js/issues/2452。你展示了一个修改过的bootstrap.less文件,我认为你不需要这些修改。
您应该创建一个包含以下代码的文件src/less/project.less:
@import "../../bower_components/bootstrap/less/bootstrap.less";在运行bower install bootstrap之后,上面的代码可以与以下命令一起使用:
var gulp = require('gulp'),
less = require('gulp-less');
gulp.task('default', function () {
gulp.src('src/less/*.less')
.pipe(less())
.pipe(gulp.dest('css'));
});现在,运行grunt命令将创建包含已编译的引导程序代码的css/project.css。
https://stackoverflow.com/questions/28513939
复制相似问题