简体   繁体   English

gulp炸薯条打破JS错误

[英]gulp crisper breaking on JS error

I use vulcanize with gulp to extract js from html files when writing polymer elements. 编写聚合物元素时,我将vulcanize与gulp结合使用以从html文件中提取js。 If there is an error within the js, however, vulcanize won't complete and it breaks the build process. 但是,如果js中存在错误,则硫化不会完成,并且会中断构建过程。 My understanding was that vulcanize simply moved everything within script tags to a new file which could then be linted however this is showing that it isn't the case. 我的理解是vulcanize只是将脚本标签中的所有内容移动到一个新文件中,然后可以将其插入文件,但这表明事实并非如此。 Does anyone know a solution to this? 有人知道解决方案吗?

Vulcanize is not actually the tool that separates your JavaScript. Vulcanize实际上并不是分隔JavaScript的工具。 It will fetch inline scripts for you that are referenced in the files you are concatenating, but it will not move them to a separate file. 它将为您获取要在串联文件中引用的内联脚本,但不会将它们移到单独的文件中。 As I understand it from @robdodson PolyCast videos #39 and 40, Crisper is the tool that you would use to separate the scripts from the vulcanized (ie. concatenated) file. 据我从@robdodson PolyCast视频#39和40中了解到的,Crisper是您用来从硫化文件(即串联文件)中分离脚本的工具。

I am still having trouble getting this to work myself, but I was able to successfully vulcanize my files and then pull the javascript from them by adapting the solution suggested by @ksugiarto in https://github.com/ragingwind/gulp-crisper/issues/10 . 我仍然无法自行解决此问题,但是我能够成功硫化我的文件,然后通过调整@ksugiarto在https://github.com/ragingwind/gulp-crisper/中提出的解决方案,从文件中提取javascript。 第10期

As far as not finishing vulcanize if there is an error in the JavaScript, if you cannot solve the error, it may help to set the 'inlineScripts' to false. 至于JavaScript中是否有错误,如果尚未完成硫化,则无法解决该错误,则可以将'​​inlineScripts'设置为false。 If this helps, please accept this answer, or vote it up. 如果有帮助,请接受此答案,或投票赞成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM