YUI compressor: undeclared character found

I have a collection of Javascript files that together form a system. Different parts of the system are in different (global) namespaces (e.g. NSA, NSB, etc.), and these namespaces can be objects, for example.

NSA = { ... lots of stuff ... } 

Now, in my various modules, I may have code, for example:

 NSA.method(); 

My JSLints code is clean, because I declare these objects with names in a comment at the top of the file:

 /*global dNSA NSB NSC */ 

When I run YUI Compressor (v 2.4.2) in these files using the -v (verbose) switch, it gives warnings about the mentioned objects with names, for example:

 Found an undeclared symbol: $ 

and what to use $ for jQuery!

What can I do to define these variables so that YUI Compressor does not give a warning, but everything I add cannot cause the object to change.

+4
source share
2 answers

The YUI library does not recognize jQuery, so it thinks about its error. It seems he has nothing to worry about.

+2
source

Add

 var $ = window.$; 

to your code.

0
source

All Articles