我如何将外部文件添加到 google 闭包编译器以进行缩小并防止 jquery 名称被缩小

how do i add extern file to google closure compiler for minification and prevent jquery names from being minified

我有这个 link 外部文件:

https://github.com/google/closure-compiler/blob/master/contrib/externs/jquery-1.9.js

如何将它包含到 google 闭包编译器中。 https://closure-compiler.appspot.com/home

我想防止 jquery 函数被缩小。

使用externs_url参数。

例如:

// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.9.js
// ==/ClosureCompiler==

$.each([ 52, 97 ], function( index, value ) {
  alert( index + ": " + value );
});