assest pipeline how to exclude some css files?

In my assets I have

intranet   >_1.css.scss   >_2.css.scss internet   >_1.css.csss application.css application_internet.css application_intranet.css 1.css.scss 2.css.scss 3.css.scss

intranet and internet are directories. In my layout I want to exclude the files under internet and intranet. I have created application_internet.css

/* * application-internet.css

Thursday, January 5, 2012, 9:25:03 AM, you wrote:

In my assets I have

intranet   >_1.css.scss   >_2.css.scss internet   >_1.css.csss application.css application_internet.css application_intranet.css 1.css.scss 2.css.scss 3.css.scss

intranet and internet are directories. In my layout I want to exclude the files under internet and intranet. I have created application_internet.css

/* * application-internet.css * *= require_self *= require_tree ./internet */

and applicatiion_intranet.css

/* * application-intranet.css * *= require_self *= require_tree ./intranet */

to include only the css under the two directories.

application.css is:

*= require_self *= require colorbox *= require jquery.multiselect *= require superfish *= require_directory . */

What can I do if I want to exclude the files under internet and intranet directories?

You might find this video useful: #282 Upgrading to Rails 3.1 - RailsCasts

Best,

ralph

I know that video and don't help me.

Well, the easiest way would be to simply remove the files you don't want to use?

You might also try using a dynamic css, if you rename your application.css to application.css.erb it will still work as before but now you can embed ruby code. If your other css files have a different ending (e.g. .dcss) they won't be loaded automatically, but you can include them in your application.css.erb file with simple render statements, possibly something like:

<%render :file mycss.dcss, :content_type => 'text/css'%>

-----Oprindelig meddelelse-----

Well, the easiest way would be to simply remove the files you don't want to use?

No, I need them for another layout in the same application.

You might also try using a dynamic css, if you rename your application.css to application.css.erb it will still work as before but now you can embed ruby code. If your other css files have a different ending (e.g. .dcss) they won't be loaded automatically, but you can include them in your application.css.erb file with simple render statements, possibly something like:

<%render :file mycss.dcss, :content_type => 'text/css'%>

Well, I didn't know that, thank you for the useful information.

Hi again - I've got a fully dynamic css setup which includes using a css controller. That way you get the option of passing variables to your css from Rails, basically you can enable full programmatic control of your stylesheets.

What I've got is following:

dcss_controller.rb:

        class DcssController < ApplicationController           def dstyle              render :file => 'dcss/dstyle.css', :content_type => 'text/css'           end         end

routes.rb:

        ...         match 'dcss/dstyle' => 'dcss#dstyle'         ...

/app/views/dcss/dstyle.css.erb

        This file contains ruby code in <% %> and normal css code. You can render your other stylesheets from here.

application.html.erb:

        ...         <%= stylesheet_link_tag dcss_dstyle_url %>         ...

-----Oprindelig meddelelse-----

Interesting solution. I've used this approach: