Muhammad Umer
Muhammad Umer

Reputation: 18097

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

I have this link for extern file:

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

How do i include it into google closure compiler. https://closure-compiler.appspot.com/home

I want to prevent jquery function from getting minified.

Upvotes: 0

Views: 195

Answers (1)

TachyonVortex
TachyonVortex

Reputation: 8592

Use the externs_url parameter.

For example:

// ==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 );
});

Upvotes: 1

Related Questions