Following a previous question,
I realize why it's not possible to generically minify properties of objects. But what if I can safely assume that certain properties are never ever going to be accessed using theobj['propNam开发者_开发百科e']
notation? This should make it possible for the minifier to change the name of the property.
Current minifiers however don't seem to have this option so can this be implemented before the minifier using some simple simple script (sed or even perl) ?It has nothing to do with using square bracket notation. Those minifiers simply don't know what code has access to obj
, so if some code tries to access obj.propName
, but the minifier changed that property name, the code will break.
I left an answer to your previous question showing that the "Advanced" optimization feature of Google Closure Compiler does what you want.
精彩评论