Lorena Bento
Lorena Bento

Reputation: 554

Assets - Css its not loaded

I have a login page with a css separate, I put the css in a folder inside app/assets/sessions. But it's not working. The css it's not loading.

When the user make login in the app, the others files works. I don't know what I'm do wrong, I organize my files in folders inside assets.

app
--assets
---images
---stylesheets
----all
-----...
----sessions
-----user_sessions.css
application-all.css
application-sessions.css

application-sessions.css

/*
*= require_self
*= require_tree ./sessions/
*/

user_sessions.css

html, body, div,.... section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
......

In my layouts/application.html.erb

<% if current_user %>
  <%= stylesheet_link_tag  "application-all", :media => "all" %>
<% else %>
  <%= stylesheet_link_tag  "application-sessions", :media => "sessions" %>
<% end %>

Sorry for my englsih :P

Upvotes: 0

Views: 72

Answers (2)

Lorena Bento
Lorena Bento

Reputation: 554

I found the mistake.

In application.html.erb, I changed this:

<% if current_user %>
  <%= stylesheet_link_tag  "application-all", :media => "all" %>
<% else %>
  <%= stylesheet_link_tag  "application-sessions", :media => "sessions" %>
<% end %>

to this:

<% if current_user %>
  <%= stylesheet_link_tag  "application-all", :media => "all" %>
<% else %>
  <%= stylesheet_link_tag  "application-sessions", :media => "all" %>
<% end %>

Upvotes: 0

ElCoyote
ElCoyote

Reputation: 311

May be you mean:

app
--assets
---images
---stylesheets
----all
-----...
----sessions
-----user_sessions.css
----application-all.css
----application-sessions.css

application-all.css and application-sessions.css must be placed in app/assets/stylesheets as I see

Upvotes: 1

Related Questions