In my app I have the follow line
<%= stylesheet_link_tag "global.css", "pop_div.css", "log_in.css.erb" %>
log_in.css.erb is a simple css with one of the lines have a
background: url(<%= asset_path 'LightBg.png' %>);
and after looking at the source it turned into
background: url(/assets/LightBg.png);
which I guess is correct, since the website works.
My confusion is:
1- why does it give a url for /assets/lightbg.png while in the public/asset directory the file is actually called LightBg-47c90e283c305c002f6973edf4054002.png
2- Why in the source of the page I see
< link href="/assets/log_in.css.erb?body=1" media="screen" rel="stylesheet" type="text/css" />
and not log_in-447fd7902dbf635bf4231025699ce36a.css which is the name of the file in public/assets.
Shouldn’t the compilation process turn the call of log_in.css.erb to log_in.css?
Thanks
The hashing is only enabled for production, in development you still get the plain file names. If you require other stylesheets and javascripts than application.js and application.css, you need to set the
config.assets.precompileinconfig/environments/production.rb. And I’m not sure, if you still can pass several stylesheets tostylesheet_link_tag. But usually you want all javascripts and stylesheets compiled into a single file (application.js and application.css).