Ensure precompile setting from app is applied to rake task.#36
Ensure precompile setting from app is applied to rake task.#36brandon-beacher wants to merge 1 commit intorails:masterfrom
Conversation
* Rails calls `load_tasks` prior to the app's configure block. * This results in the sprockets rake task being initialized without the app's assets.precompile setting. * This change lazily evaluates the assets setting in the rake task so it will reflect the eventual configuration of assets.precompile.
|
I think we want delegation over option copying. 👎 |
|
Left a comment on this here sstephenson/sprockets#404 (comment) |
|
@josh Could you expand a bit on what you mean by "delegation over option copying" here? Are you suggesting that the Rake task should directly delegate to The issue @brandon-beacher brings up results in not being able to vendor and automatically precompile things like images nor fonts in production - which seems broken to me. |
|
|
|
Does somebody have this, or should I manually apply sstephenson/sprockets#404 and #35 for my own app? Currently this is a rails 4 upgrade game breaker for anybody who uses multiple folders within their stylesheet asset folder (because you have to manually tell it to compile certain files) |
|
@alainmeier we've just been manually copying the loose assets from third party gems into app/assets by hand for now... |
|
Rails team released Rails 4 beta, but Sprockets is still broken. |
|
Link: rails/rails#9572 |
Document changes from #7968 in Upgrading Guide
|
@josh, is this good to go? |
|
iirc, this work correctly setting |
|
@guilleiguaran Right. But still it seems Rails recommends to set this things on per-environment basis. And that doesn't work. |
|
And precompiling in development is usually undesireable. |
|
What's preventing this from getting accepted? It seems like several people are running into the issue of trying to configure assets in an environment-specific configuration file, which silently fails. I'm in favor of this approach as a short-term solution, with the goal that a more ideal long-term solution would fit better into the asset pipeline (without needing lazy evaluation). |
|
@btaitelb +1 The Rails generator puts |
|
Any updates on this? |
|
config.assets.precompile += ... doesn't work for me either on production ... |
|
Is there a workaround to this? |
|
@eddiej move the setting to application.rb where it will get picked up. |
|
|
|
Yes. But += used to work, I believe. It's a nasty gotcha. On Jun 3, 2013, at 7:02 PM, Guillermo Iguaran notifications@github.com wrote:
|
I was not able to use the precompile setting to solve the situation described here:
#34
This is due to the details below:
Rails calls load_tasks prior to the app's configure block.
This results in the sprockets rake task being initialized without the app's assets.precompile setting.
This change lazily evaluates the assets setting on the sprockets rake task so they will reflect the eventual assets.precompile setting.
With this change, loose assets in lib or vendor from a legacy gem will now be picked up if they are explicitly specified in the precompile setting.
This is dependent upon sstephenson/sprockets#404