我正在使用 gulp-minify-inline-scripts:
https://www.npmjs.org/package/gulp-minify-inline-scripts
我在我的 gulp 文件中得到了它,如下所示:
gulp.task('minify-inline', function() {
gulp.src('www/**/*.html')
.pipe(minifyInline())
.on('error', gutil.log)
.pipe(gulp.dest('www'))
});
但是,每当我运行 gulp 任务时(即使从站点文件中删除了所有内联脚本),我都会收到此错误消息并且我无法弄清楚问题是什么:
{ [Error: uglify inline scripts error: Error
at new JS_Parse_Error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:189:18)
at js_error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:197:11)
at croak (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:656:9)
at token_error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:664:9)
at unexpected (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:670:9)
at semicolon (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:690:43)
at simple_statement (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:864:73)
at /Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:723:47
at /Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:703:24
at block_ (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:977:20)]
message: 'uglify inline scripts error: Error\n at new JS_Parse_Error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:189:18)\n
at js_error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:197:11)\n
at croak (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:656:9)\n
at token_error (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:664:9)\n
at unexpected (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:670:9)\n
at semicolon (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:690:43)\n
at simple_statement (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:864:73)\n
at /Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:723:47\n
at /Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:703:24\n
at block_ (/Users/heather/Documents/Work/company/Web/NewSite/node_modules/gulp-minify-inline-scripts/node_modules/uglify-js/lib/parse.js:977:20)',
showStack: false,
showProperties: true,
plugin: 'gulp-minify-inline-scripts',
__safety: { toString: [Function] } }