Reputation: 69
I have code written in many places. I want to refactor the code to be able to use JavaScript compiler for performance and syntax check reasons. What is the recommendation to prepare the code for compiling?
Code:
<% if(product.type){ %>
$('#someid').html('<%= product.type %>'); //javascript
<% } %>
var
), in that case it'll surely collapse my code.I've heard that writing in closure style helps variable collision between each script files. Do I have to rewrite all code using that pattern? Do I have to construct the code from scatch? I'm asking for the way to prepare the code to be compiled, any suggestion?
Upvotes: 1
Views: 110
Reputation: 207501
The compiler does not change global and property names. It just renames the local variables and removes the whitespace.
Upvotes: 0