KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I’m in the process of building my first solo Rails app using Rails 3.1.rc5. My problem is that I want to have my site render the various CSS files conditionally. I’m using Blueprint CSS and I’m trying to have sprockets/rails render screen.css most of the time, print.css only when printing, and ie.css only when the site is accessed from Internet Explorer. Unfortunately, the default *= require_tree command in the application.css manifest includes everything in the assets/stylesheets directory and results in an unpleasant CSS jumble. My current workaround is a sort of brute-force method where I specify everything individually: In application.css: *= require_self *= require home.css ... *= require blueprint/screen.css In my stylesheets partial (haml): <!--[if lt IE 9] <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> ![endif]--> = stylesheet_link_tag "application" = stylesheet_link_tag 'blueprint/print', media: 'print' <!--[if lt IE8]] = stylesheet_link_tag 'blueprint/ie' ![endif]--> = javascript_include_tag "application" This works but it’s not especially pretty. I’ve done a few hours of searching to even get this far but I’m hoping that there’s some easier way to do it that I’ve just missed. If I could even selectively render certain directories (without including subdirectories) it would make the whole process a lot less rigid. Thanks!
Tags (comma-separated)
Save Edits
Cancel