![](/img/trans.png)
[英]Ordering the output using gulp and main-bower-files (gulp-order doesn't work)
[英]SyntaxError: Unexpected end of input error using Gulp and main-bower-files package
我一直在嘗試將主要的bower文件注入我的構建文件夾index.html時出錯
我正在使用main-bower-files NPM 包 。
我的代碼看起來像這樣:
//requires
var gulp = require('gulp');
var inject = require('gulp-inject');
var config = require('./gulp-config');
var mainBowerFiles = require('main-bower-files');
gulp.task('default', ['move'], function() {
return gulp
.src(config.buildFolder + config.indexFile)
.pipe(
inject(
gulp.src( mainBowerFiles() ), {base: './bower_components'}
)
)
.pipe(gulp.dest(config.buildFolder));
});
gulp.task('move', function() {
return gulp
.src(config.indexFile)
.pipe(gulp.dest(config.buildFolder));
});
這給了我以下錯誤
SyntaxError: Unexpected end of input
所以這個真的讓我煩惱(我在NPM包代碼下偷看,看看是否確實有意外的輸入錯誤結束,但錯誤是我的錯)。
問題出在我的文件結構中,我有一個空的.bowerrc文件,我通過鍵入$ touch .bowerrc
從終端生成。 只需添加
{
"directory": "(your bower components folder here as valid JSON)"
}
並且......錯誤消失了! 希望這能給別人帶來盡可能多的麻煩。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.