google-closure-compiler

How to do localization in Google Closure

元气小坏坏 提交于 2021-02-07 20:25:56
问题 Currently I am using just plain text in my Closure application. I want to add localizations to those text. I just found several articles about goog.getMsg function which is used to do this kind of localization. As far as I understood it is done in compile time. How can we change language in run-time when user clicks a button? What is the easiest way to do this using Closure? 回答1: I have actually achieved a runtime i18n. I use .soy templates with {msg} tags in them. When you compile .soy to

How to do localization in Google Closure

醉酒当歌 提交于 2021-02-07 20:20:34
问题 Currently I am using just plain text in my Closure application. I want to add localizations to those text. I just found several articles about goog.getMsg function which is used to do this kind of localization. As far as I understood it is done in compile time. How can we change language in run-time when user clicks a button? What is the easiest way to do this using Closure? 回答1: I have actually achieved a runtime i18n. I use .soy templates with {msg} tags in them. When you compile .soy to

Google Closure suppress warning messages for a particular file

亡梦爱人 提交于 2021-01-28 03:04:04
问题 I am using google closure compiler to compress all the javascript into single file. While compliance it give lot of warning messages.In my case I have already compressed third party JS files, Which causes complete file to be printed on browser (i saw build progress in browser) for a single error. I cannot modify third party js due to licenses issue. I am getting tons of warning messages with complete code in browser window, which causes browser to be hanged. How can I suppressed all the

javascript - how to minfy/obfuscate global function names?

女生的网名这么多〃 提交于 2020-12-04 03:36:51
问题 I have some code that has the following format: function myfunc1 () { ... jquery.bind('click', myfunc2) ... } function myfunc2 () { ... } ... Yes, the functions are global, but it's ok since I'm writing within a google chrome extension content script, so it's sandboxed. Now, I'm trying to minify and obfuscate the code. I've tried YUI Compressor and the Google Closure compiler. The problem is, I can't figure out how to minify/obfuscate the global function names. With YUI it doesn't minify the

Can I compile SJCL library with Google closure compiler?

China☆狼群 提交于 2020-06-29 03:20:08
问题 I have a vanilla javascript project that is compiled and minified using Closure Compiler v20181210. I want to use SJCL in that project for crypto. I copied this file into my own project and wrote code using the library. But when I try to compile it, Closure Compiler throws a bunch of errors from the library (pasted below). On the SJCL website, it says that the file is compressed using Google Closure Compressor. So I imagine it should be compatible with Closure? Why is it not compiling then?

Test if object is implementation of interface in Google Closure class framework

元气小坏坏 提交于 2020-01-23 07:07:49
问题 How can I test if an JavaScript object is an implementation of an interface using the Google Closure inheritance mechanism? I could not find any hint of my.Animal in the objects created via new my.Dog() and object instanceof my.Animal didn't work. The only information about the interface are compiler errors when forgetting to implement methods in the child class. /** * @interface */ my.Animal = function() {}; /** * Does something. * @return {string} */ my.Animal.prototype.doSomething; /** *

How to use Google Closure compiler

对着背影说爱祢 提交于 2020-01-22 16:27:08
问题 I'm trying to migrate from the closurebuilder.py script to the Closure compiler because of this message: ../../closure-library/closure/bin/build/closurebuilder.py: Closure Compiler now natively understands and orders Closure dependencies and is prefererred over using this script for performing JavaScript compilation Since I'm using Google Closure Library and the OpenLayers 3, how do I have to call the compiler (compiler.jar) to Build an myapp-deps.js dependency file Build an minified version

Is it possible to make Google Closure compiler *not* inline certain functions?

一曲冷凌霜 提交于 2020-01-22 12:33:03
问题 Closure compiler is inlining a function, but the code size is smaller if that function is not inlined (I only care about code size - this is for JS1k). Can I tell the compiler that I don't want that function inlined? Edit: Just to explain a bit better, here's my function: function lineTo(x,y) { a.lineTo(x,y); } where a in the canvas context. Because there are so many a.lineTo s in the code, having this function used is worth it. Like this, my code is 1019 bytes (and all the lineTo s are

Is it possible to make Google Closure compiler *not* inline certain functions?

旧城冷巷雨未停 提交于 2020-01-22 12:31:59
问题 Closure compiler is inlining a function, but the code size is smaller if that function is not inlined (I only care about code size - this is for JS1k). Can I tell the compiler that I don't want that function inlined? Edit: Just to explain a bit better, here's my function: function lineTo(x,y) { a.lineTo(x,y); } where a in the canvas context. Because there are so many a.lineTo s in the code, having this function used is worth it. Like this, my code is 1019 bytes (and all the lineTo s are

Is it possible to make Google Closure compiler *not* inline certain functions?

别等时光非礼了梦想. 提交于 2020-01-22 12:31:28
问题 Closure compiler is inlining a function, but the code size is smaller if that function is not inlined (I only care about code size - this is for JS1k). Can I tell the compiler that I don't want that function inlined? Edit: Just to explain a bit better, here's my function: function lineTo(x,y) { a.lineTo(x,y); } where a in the canvas context. Because there are so many a.lineTo s in the code, having this function used is worth it. Like this, my code is 1019 bytes (and all the lineTo s are