Last active
October 30, 2017 14:27
-
-
Save averyvery/45cede57d335fe0b6b55 to your computer and use it in GitHub Desktop.
Load view-specific CSS in Rails
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
def view_css | |
path = "views/#{params[:controller]}/#{params[:action]}" | |
stylesheet_link_tag(path) unless Rails.application.assets.find_asset(path).nil? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment