使用GruntJs来缩小脚本 [英] Minifying scripts using GruntJs

查看:90
本文介绍了使用GruntJs来缩小脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个js文件,我似乎可以让GruntJs正确地连接/缩小。

如果我单独做每个人,他们工作得很好。



如果我单独合并,然后尝试缩小组合文件,它也不起作用。



这里是错误:



关于如何解决这个问题的任何想法?或者是什么原因造成的?

解决方案

GruntJs和我在Derick的回答中提到的BOM目前存在问题。

你可以在这里找到问题: https://github.com/cowboy/grunt/issues/218#issuecomment-6329807



在Visual Studio中手动删除BOM打开文件>文件>高级保存选项>将编码设置为无签名的Unicode>确定
这应该删除它。

I have a couple js files that I can seem to get GruntJs to concat/minify properly.

If I do each individually they work fine.

If I combine separately then attempt to minify just the combined file it doesn't work either.

Here is the error:

Any ideas on how to fix this? Or maybe what is causing it?

解决方案

There is currently a problem with GruntJs and the BOM I mentioned in the comment of Derick's answer.

You can find the issue here: https://github.com/cowboy/grunt/issues/218#issuecomment-6329807

In Visual Studio to manually remove the BOM

Open the file > File > Advanced Save Options > Set the encoding to "Unicode without signature" > "Ok" That should remove it.

这篇关于使用GruntJs来缩小脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆