Assets say “not precompiled” when they are precompiled

家住魔仙堡 提交于 2019-11-30 08:28:11
Phantomwhale

I have been wrestling with the problem myself, although with config.assets.compile = false set, as I suspect the example above was with the flag set to true.

Cannot configure assets via pipeline on local production rails 3.1.3 server

My observations came down to it being a Sprockets 2.0.3 bug, as UberNeet suggested towards. The workaround was to either remove the period from the asset name, or include it as part of a manifest, rather than link to it directly.

The bug report for this is here: https://github.com/rails/rails/issues/3398

Looking at your issue above, and tallying it with my experience from the last two days, I suspect there is an associated issue with asset naming when config.assets.compile = true is set. This issue probably stems from the asset naming - your manifest has the jquery.autocomplete library percompiled as:

jquery-5550a245a55b28927b5552cac182e612.autocomplete.js

But when you precompile these assets via rake using rake assets:precompile, I believe they are actually compiled to:

jquery.autocomplete-5550a245a55b28927b5552cac182e612.js

It is probably this discrepancy that is causing the issue you mentioned. Might be worth raising another github issue for this too, although the workarounds are listed above, and I understand that Rails 3.2 will be using Sprockets 2.1.0, which may contain the fix for this issue already.

Add the .js to

javascript_include_tag 'jquery.autocomplete.js'

Seems like there is an missing functionality. When the filename has a period '.' in the name, the .js extension will not get added when looking into the digest.

I did some debugging to Sprockets::Helpers::RailsHelper and it seems like digest_for methods gets the logical path without the .js.

Be shure that it isn't required before in application.js for example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!