我正在编写一个 jQuery 插件,我想通过用枚举替换常用的 CSS 属性字符串来缩小脚本的大小。但是,Google 的 Closure Compiler 将所有字符串变量替换为字符串文字。例如,选择高级优化:
这
var x = "hey bob how are you doing";
alert(x);
alert(x);
alert(x);
alert(x);
返回
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");
在不通过像 JScrambler 这样的字符串压缩器发送代码的情况下,做我想做的事情的正确方法是什么?
提前致谢。