使用Google Closure编译器 [英] Using Google Closure compiler

查看:185
本文介绍了使用Google Closure编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
使用Google Closure编译器编译的jQuery

Possible Duplicate:
jQuery compiled with Google Closure Compiler

我正在使用jQuery,并且我的所有JS代码都位于application.js文件中.当我使用Google Closure编译器(使用高级选项)编译"application.js"时,我得到了一个没有错误和警告的js文件.但是,我无法在页面中使用该文件,页面加载时出现错误,提示"TypeError:表达式'$("div.tile").d'的结果[未定义]不是函数."

I am using jQuery and I have all of my JS code in application.js file. When I compile "application.js" with the Google Closure compiler (using the advance options) I get a js file with no errors and warning. However, I am unable to use the file in my page, I get an error on page load which says "TypeError: Result of expression '$("div.tile").d' [undefined] is not a function."

我的问题是我可以编译使用jQuery的js文件吗?

My question is can I compile a js file which uses jQuery?

推荐答案

是的,如果您希望在其他文件中包含jQuery文件.

Yes, if you care to include the jQuery file in with your other file.

是的,如果您使用简单模式,那么.

Yes, if you use simple mode, instead.

否则,不会.

这篇关于使用Google Closure编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆