What is the proper way to minify strings using Google's Closure Compiler?

Viewed 727

I'm in the middle of writing a jQuery plugin, and I'd like to shrink the size of my script by replacing commonly used CSS property strings with enums. However, Google's Closure Compiler replaces all string variables with string literals. For example, with advanced optimization selected:

this

var x = "hey bob how are you doing";
alert(x);
alert(x);
alert(x);
alert(x);

returns

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");

What is the right way to do what I'm trying to do without sending my code through a string compressor like JScrambler?

Thanks in advance.

1 Answers
Related