【发布时间】:2012-08-15 20:34:09
【问题描述】:
我正在尝试让 Google Closure Compiler 编译我的使用 Jquery 的 javascript 代码,但我不断收到变量 $ 未声明有没有办法让它看到 $ 变量。有没有办法让闭包编译器看到 Jquery 库但不编译它。 这是我的蚂蚁脚本
<?xml version="1.0"?>
<project basedir="." default="compile">
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="build/compiler.jar"/>
<target name="compile">
<jscomp compilationLevel="simple" warning="verbose"
debug="false" output="output/file.js">
<sources dir="${basedir}/src">
<file name="js.js"/><!-- the file I'm trying to compile -->
</sources>
</jscomp>
</target>
</project>
我的 Jquery 库名为 min.js,它在 src 文件夹中带有 js.js
我确定这是一个简单的问题,但我只是遗漏了一些东西。提前致谢!
【问题讨论】:
-
Here is a similar question 和 an article 提到将 jQuery 声明为外部
-
似乎您的默认外部人员不包括在内
标签: javascript jquery ant google-closure-compiler