Created
September 20, 2011 21:42
-
-
Save patmaddox/1230489 to your computer and use it in GitHub Desktop.
conditionally link to precompiled assets in rails 3 asset pipeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def controller_asset_javascript | |
javascript_include_tag(controller_name) if Rails.configuration.assets.precompile.include?("#{controller_name}.js") || !Rails.env.production? | |
end | |
def controller_asset_stylesheet | |
stylesheet_link_tag(controller_name) if Rails.configuration.assets.precompile.include?("#{controller_name}.css") || !Rails.env.production? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment