Assets say “not precompiled” when they are precompiled

前端 未结 3 655
旧时难觅i
旧时难觅i 2020-12-31 05:48

Ok so, I\'m getting this error when I try to use the asset pipeline. I don\'t understand what\'s causing it.

Sprockets::Helpers::RailsHelper::AssetPaths::Ass         


        
相关标签:
3条回答
  • 2020-12-31 06:17

    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.

    0 讨论(0)
  • 2020-12-31 06:33

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

    0 讨论(0)
  • 2020-12-31 06:40

    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.

    0 讨论(0)
提交回复
热议问题