3

How can i add multiple css files in rails project ?

I do,

<%= stylesheet_link_tag :cssone %>

Now i need to add more css file.

3 Answers 3

11

There are some method to achieve this. First of all, you can specify each manually :

<%= stylesheet_link_tag "first.css" %>
<%= stylesheet_link_tag "second.css" %>
<%= stylesheet_link_tag "third.css" %>

Then, you can wrap those 3 lines in a single one :

<%= stylesheet_link_tag "first.css", "second.css", "third.css" %>

Also, if you want to include all of your stylesheets in the dedicated rails folder (/public/stylesheets/), you can do :

<%= stylesheet_link_tag :all %>

If you have subfolders in the dedicated folder, you have to include the :recursive option

<%= stylesheet_link_tag :all, :recursive => true %>
Sign up to request clarification or add additional context in comments.

Comments

1
<%= stylesheet_link_tag :cssone, :csstwo, and so on... %>

Comments

1

In your (assets/stylesheets) Add your multiple css file let us take eg-a.css,b.css and c.css

NOW

In application.rb write

<%= stylesheet_link_tag "first.css", "second.css", "third.css" %>

Comments

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.