# How to deal with css files only for specific pages.

**URL:** <https://discuss.rubyonrails.org/t/how-to-deal-with-css-files-only-for-specific-pages/69614>\
**Category:** rubyonrails-talk\
**Created:** [September 18, 2014, 5:08pm UTC](https://discuss.rubyonrails.org/t/how-to-deal-with-css-files-only-for-specific-pages/69614 "2014-09-18T17:08:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roelof\_Wobben](https://avatars.discourse-cdn.com/v4/letter/r/e99b99/32.png) [@Roelof\_Wobben](https://discuss.rubyonrails.org/u/Roelof_Wobben)\
**Post date:** [September 18, 2014, 5:08pm UTC](https://discuss.rubyonrails.org/t/how-to-deal-with-css-files-only-for-specific-pages/69614/1 "2014-09-18T17:08:48Z")

</div>

hello,

I have found a html template where I some pages need specific css files and of course there are some common css files.

How can I best deal with it ?

Roelof

---

<div class="post-metadata">

**Author:** ![Jason\_FB](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/jason_fb/32/826_2.png) [@Jason\_FB](https://discuss.rubyonrails.org/u/Jason_FB)\
**Post date:** [September 18, 2014, 5:37pm UTC](https://discuss.rubyonrails.org/t/how-to-deal-with-css-files-only-for-specific-pages/69614/2 "2014-09-18T17:37:20Z")

</div>

You have the option of creating a specific manifest file for a particular page (or area of the site). This can be a good idea.

You would then need to use a different layout for that page, pointing to the different manifest file.

Usually, what I do is use the same manifest file for the whole site and _scope the CSS itself_ to certain pages (instead of using different manifest files)

In particular, I am a fan of making the tag in my layout look like this:

Then, in my CSS, I scope CSS specific to that page like so:

body.home.index

(this would apply styles only to the _home_ controller’s _index_ action, for example)

If you have two completely separate sections of the website, and the sections do not share the same layout file, then maybe making different manifest files is the way to go.
