Skip to content

Ensure precompile setting from app is applied to rake task.#35

Merged
brandon-beacher merged 0 commit intorails:masterfrom
brandon-beacher:master
Jan 13, 2013
Merged

Ensure precompile setting from app is applied to rake task.#35
brandon-beacher merged 0 commit intorails:masterfrom
brandon-beacher:master

Conversation

@brandon-beacher
Copy link
Copy Markdown

OK - taking another swing at this with a different approach.

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 stores a reference to the sprockets rake task so the assets can be updated with the properly configured 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.

@guilleiguaran
Copy link
Copy Markdown
Member

/cc @josh

@josh
Copy link
Copy Markdown
Contributor

josh commented Jan 10, 2013

Is there anyway to write a test for this?

@brandon-beacher
Copy link
Copy Markdown
Author

Yep - needs a test - I'll add one.

@brandon-beacher
Copy link
Copy Markdown
Author

Ok after writing the tests I think there is a cleaner, more consistent way to do this.

It has a prerequisite of sstephenson/sprockets#404

This allows the rake task to set t.assets = lambda { app.config.assets.precompile } which should do the trick.

Now to consider how to test this in sprockets-rails!

@brandon-beacher brandon-beacher merged commit 0228520 into rails:master Jan 13, 2013
@brandon-beacher
Copy link
Copy Markdown
Author

Closed in favor of a better solution here: #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants