javascript 缩小的 JS 导致 JS 无法工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3579183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Minified JS causes JS to not work
提问by dzm
I'm using carabiner for CodeIgniter which can minify all the javascript files it loads. Well, I have about 10 files that work fine, then when minified, they don't... I'm not sure exactly what doesn't work, there are no errors, just certain features that don't work. Is there any particular reason why minifying JavaScript would cause it to not work?
我正在为 CodeIgniter 使用登山扣,它可以缩小它加载的所有 javascript 文件。嗯,我有大约 10 个文件可以正常工作,然后在缩小时,它们不会......我不确定到底什么不起作用,没有错误,只是某些功能不起作用。缩小 JavaScript 会导致它不起作用有什么特别的原因吗?
回答by S.Jones
You may want to try running JSLinton your Javascript code before you try to minimize it. JSLint might highlight some issues, which could allow you to minimize your code without error.
在尝试将其最小化之前,您可能想尝试在您的 Javascript 代码上运行JSLint。JSLint 可能会突出一些问题,这可以让您无误地最小化代码。
Or you may want to try another 'minification' tool.
或者您可能想尝试另一个“缩小”工具。
Here are two articles I've found on 'A List Apart,' that may interest you, looking at the YUI Compressor.
这是我在“A List Apart”上找到的两篇文章,您可能会对 YUI Compressor 感兴趣。
"Better JavaScript Minification"
"JavaScript Minification Part II"

