Gulp - 使用 gulp-uglify 和 gulp-concat 的意外令牌错误
Gulp - unexpected token error using gulp-uglify and gulp-concat
这是我的代码
gulp.task('js', function () {
return gulp.src(['public/js/angular.js','public/js/app.js', 'public/js/**/*.js'])
.pipe(plumber({
errorHandler: function(err){
console.log(err);
this.emit('end');
}
}))
.pipe(concat('filename.min.js'))
.pipe(uglify().on('error', gutil.log))
.pipe(gulp.dest('public/js') //destination of new file
.pipe(notify({ message: 'Finished minifying JavaScript'})))
gulp.task('watch', function(){
gulp.watch('app/assets/sass/**/*', ['css']);
gulp.watch('public/js/**/*', ['js']);
});
对任何 js 文件进行更改后出现控制台错误:
/projects/miche-web/public/js/miche.min.js:意外的令牌名称"替换",预期的双关语",»] 消息: '/Users/projects/miche-web/public/js/miche.min.js: 意外的令牌名称 «替换», 预期的双关语 «,», 文件名: '/Users/projects/miche-web/public/js/miche.min.js', 行号: 247,
但是,该文件是空白的,因此我无法引用第 247 行的错误。
有什么想法吗?
您的pipe
调用中存在语法错误。观察以下内容...
.pipe(gulp.dest('public/js') //destination of new file
=>
.pipe(gulp.dest('public/js')) //destination of new file
请注意初始函数调用中缺少)
相关文章:
- React JS:未捕获(在承诺中)语法错误:在位置 0 的 JSON 中意外<令牌
- jQuery$.getJSON抛出意外令牌
- 为什么我在下面的..of循环中得到意外令牌
- 组件中的ReactJS意外令牌
- AngularJS $http GET 请求到本地 JSON 文件返回语法错误:意外令牌]
- 巴别塔,意外令牌 (15:33) ::.
- Sencha 2.0 和 Codeigniter RESTful API 生成未捕获的语法错误:意外令牌:
- 在事件上使用 jquery 时出现意外令牌
- JSON 中位置 4 处的意外令牌<
- 意外令牌 ) 在我的代码中
- Electron 和 Babel 6 异步/等待抛出意外令牌
- “JSON.parse(str)”返回“意外令牌c”,但str是一个字符串
- jQuery after() uncatch SyntaxError: 意外令牌 ILLEGAL
- 使用节点javascript的意外令牌ILLEGAL
- Javascript/JQuery-Chrome意外令牌
- Ajax 帖子未捕获语法错误:意外令牌非法
- angularjs-SyntaxError:请求从服务器返回时出现意外令牌
- jquery:使用ember的意外令牌C
- React本机项目中的意外令牌
- 解析有效的 JSON 得到“语法错误:意外令牌非法”