0

I am developing an application with Ruby on Rails, and I'm using bootstrap to upgrade my CSS.

My question is:

If I have the next URL link: link href="css/bootstrap.css" rel="stylesheet"

How can I redefine the URL to be a relative one, thus it will not break if I rearrange my

project's files?

rekire
  • 47,260
  • 30
  • 167
  • 264

2 Answers2

2

I think that the best practice is to put the stylesheets in the following directory:

app/assets/stylesheets

And include it using:

stylesheet_link_tag 'name'

But if you are using Bootstrap I highly recommend to use a Gem (For example http://rubygems.org/gems/twitter-bootstrap-rails), that way it will handle automatically the stylesheets and javascripts of the framework.

Mauricio Ulloa
  • 532
  • 1
  • 4
  • 14
1

Use rails assets pipeline. See this guide:

http://guides.rubyonrails.org/asset_pipeline.html

Bob
  • 2,081
  • 18
  • 25