小编Ste*_*nch的帖子

使用Google的Closure Compiler缩小字符串的正确方法是什么?

我正在编写一个jQuery插件,我想通过用枚举替换常用的CSS属性字符串来缩小脚本的大小.但是,Google的Closure Compiler用字符串文字替换所有字符串变量.例如,选择高级优化:

这个

var x = "hey bob how are you doing";
alert(x);
alert(x);
alert(x);
alert(x);
Run Code Online (Sandbox Code Playgroud)

回报

alert("hey bob how are you doing");alert("hey bob how are you doing");alert("hey bob how are you doing");alert("hey bob how are you doing");
Run Code Online (Sandbox Code Playgroud)

如果不通过像JScrambler这样的字符串压缩器发送我的代码,我正在尝试做什么的正确方法是什么?

提前致谢.

javascript google-closure-compiler

13
推荐指数
1
解决办法
703
查看次数