the best way to have separate stylesheets for different actions in Rails -


i have 1 app layout includes app wide css stylesheets , js files, controller's actions need additional stylesheets used these action s view? best way include them?

if app typically like:

<html>   <head>     <%= stylesheet_link_tag 'application' -%>     <%= javascript_include_tag 'yui', 'application' -%>   </head>   <body>     <%= yield -%>   </body> </html> 

you can add other yield blocks wherever like, named whatever want. typically used include page-specific functionality wherever like, degree maybe partials supply own.

# layouts/application.html.erb <html>   <head>     <%= stylesheet_link_tag 'application' -%>     <%= javascript_include_tag 'yui', 'application' -%>     <%= yield :head -%>   </head>   <body>     <%= yield -%>   </body> </html>  # views/profiles/show.html.erb <%= title("#{@user.name}'s profile") -%>  <% content_for :head -%>   <%= javascript_include_tag 'gallery' %> <% end %>  <%= render @user.photos %> 

so on , forth...


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -