Refactor sprockets asset paths to allow for alternate asset environments #1925

Merged
merged 3 commits into from Jul 3, 2011

2 participants

@spohlenz

This patch refactors the Sprockets asset path helpers to make it easier to integrate alternate asset environments and prefixes. In my specific case, this makes integrating themes using the asset pipeline a whole lot easier.

The main change is to source the asset environment and prefix from helper-level methods (asset_environment and asset_prefix), rather than hard-coded within the AssetPaths class.

@josevalim
Ruby on Rails member

Could you please add a test case with the kind of customization you have in mind, otherwise someone can change it again in the future and nothing in the test suite will point it as a regression. Docs are also important so other people can customize it as well. Finally, shouldn't those changes be done in the ActionView::AssetPaths so the whole AssetPaths chain is more flexible?

@spohlenz

I've added some tests and will work on some documentation.

These changes are specific to Sprockets and the asset pipeline so I think they fit best within Sprockets::Helpers::RailsHelper.

@josevalim
Ruby on Rails member

It looks good with tests now! Please ping me after you add some docs to the two methods you added and I will merge it.

@spohlenz

Hopefully ready to merge now.

@josevalim josevalim merged commit 3875e44 into rails:master Jul 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment