Rails 3,javascript是“未找到”在生产中运行时 [英] Rails 3, javascript is "not found" when running in production
问题描述
我知道它与资产相关,我确实用
I know it's related to assets, I do precompile the assets with
bundle exec rake assets:precompile
但是浏览器只给了我一个javascript(jquery.formalize.min.js)文件404,这个文件没有生成由于某些原因。但是在预编译的application-xxxxxx.js中有jquery.formalize.min.js的代码。
But the browser gives me 404 for only one javascript (jquery.formalize.min.js) file, which is not generated for some reason. There is however the code for jquery.formalize.min.js inside the precompiled application-xxxxxx.js.
我将它包含在:
<%= javascript_include_tag "formalize/jquery.formalize.min", "main" %>
Chrome中的错误消息如下所示:
And the error message in Chrome looks like:
GET http://example.com/assets/jquery.formalize.min-724f21bf646762e539aa18c8db1d4d43.js 404 (Not Found)
形式化js文件的完整路径是app / assets / formalize / jquery.formalize.min.js。
Full path to the formalize js file is app/assets/formalize/jquery.formalize.min.js.
当然,application.js正常加载。
Of course, application.js is loading fine.
<%= javascript_include_tag "application", "main" %>
如何加载formalize / jquery.formalize.min.js?谢谢。
How do I load the formalize/jquery.formalize.min.js? Thanks.
推荐答案
检查您的清单文件,默认情况下是app / assets / javascript / application.js。 // = entries控制哪些文件被预处理到组合文件中。
Check your manifest file, which is app/assets/javascript/application.js by default. The //= entries control what files get pre-processed into the combined file.
这篇关于Rails 3,javascript是“未找到”在生产中运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!