I was experimenting with babili and found that the minified code it produces is significantly larger than closure (100 KiB vs 120 KiB). As it turns out, the problem is caused by the way babili handles (unicode) string literals.
Suppose that the code contains the string "теѕт" (all Cyrillic characters). Then babili converts it to "\u0442\u0435\u0455\u0442". OTOH, closure with the --charset utf8 option leaves the string in the original form. In fact, with that flag, closure converts "\u0442\u0435\u0455\u0442" to "теѕт".
So I propose to introduce to babili an option similar to closure's --charset. Of course, this should use a conservative setting by default (eg ascii), because otherwise the minified script would then require to be loaded with charset="..." in the <script> tag.
I was experimenting with
babiliand found that the minified code it produces is significantly larger thanclosure(100 KiB vs 120 KiB). As it turns out, the problem is caused by the waybabilihandles (unicode) string literals.Suppose that the code contains the string
"теѕт"(all Cyrillic characters). Thenbabiliconverts it to"\u0442\u0435\u0455\u0442". OTOH,closurewith the--charset utf8option leaves the string in the original form. In fact, with that flag,closureconverts"\u0442\u0435\u0455\u0442"to"теѕт".So I propose to introduce to
babilian option similar toclosure's--charset. Of course, this should use a conservative setting by default (eg ascii), because otherwise the minified script would then require to be loaded withcharset="..."in the<script>tag.