Hi,
I’ve created a view file, this view has some special styles.
I’ve created a custom css file in the assets folder and I want to load the css file only in thius specific view file.
Is it possible to achieve this?
I don’t want this css to be loaded in entire website.
Thanks
Can’t views have references to stylesheet assets? Just add something like this in the view:
<%= stylesheet_link_tag "application" %>
Simpliest way, add this in your application.html.erb
layout
<head>
<!-- other tags -->
<%= yield :head %>
</head>
in your desired view, add this
<% content_for :head do %>
<%= stylesheet_link_tag 'special_css' %>
<% end %>
1 Like