2

Sorry for the odd question but this is one that makes me want to bust a head. Theres a file in my rails app called project.css and I don't know if it came with the rails application built in.

One of the programmers I'm working with decided to fill it with generic styles which have effected everything that wasn't assigned its own style by id or class.

EG he writes

td
{
position:absolute;
top:20px;
font-family:Wingdings;
}

So that all his style are replicated across the entire site including my pages.

rather than going through all my pages and creating styles for every element that I need to use, can I just explicit say in my pages to ignore this file?

EG <% stylesheet_ignore_tag %>

It seems to be including the stylesheet by default so the questions are:

1: Is the project.css part of rails. if not then I'd question why the hell its bleeding all over the site.

2: Can i get rid of it or tell my pages not to load it.

3: If theres no ignore feature for stylesheets has anyone got any ideas as to how to fix it without going through each page and making styles for each element he screwed up?


Think i figured out what happened. He included this monstrosity of a css file in the application.html.erb file. This is a header that's shared across all the site. This way it seems to have effected all the individual pages being loaded aswell.

1
  • File project.css it is not a part of rails application. Try search in your other css files, maybe project.css include by import directive: @import url("/stylesheets/project.css"); Commented Aug 31, 2011 at 14:06

2 Answers 2

1

You should consider using content_for for that css file. This way you can remove it from the layout, put a <%= yield :specific_css %> instead and use content_for in the views that use that css this way:

<%= content_for :specific_css %>
  <%= stylesheet_link_tag 'your_file.css' %>
<% end %>
Sign up to request clarification or add additional context in comments.

2 Comments

so your_file would be the project.css that I dont want? or should it be a list of the css that I do actually want included. also is specific_css a generic tag when using content_for or do i have to put something custom in there?
The file is the project.css that you don't want to be included. The tag :specific_css is a custom one, you can name it the way you want. You can have as many as you want in your layout.
0

Sounds like it's being loaded in the general layout file.

If it's really not being used except to make life painful for you... why not just delete it from your repository? :)

Better yet - go ask the guy what he did that for and whether you can work something else out.

2 Comments

I've already had words. I got the legendary response "works on my machine". Nearly broke a blood vessel. They were indeed geting carried over from the layout. He refused to change the css so I changed it for him and handed it back. just locked everything for the header inside a div then put the div id before each one of his css's. Worked like a charm.
Oh, the reason he did it. Hes an idiot. Getting let go soon i believe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.