How do I use CSS with a ruby on rails application?

后端 未结 8 489
情书的邮戳
情书的邮戳 2020-12-01 04:00

How do I use CSS with RoR? When I link externally, I\'m never able to see the files. I cp\'d the .css file to every folder I could think of...views, controller, template, an

8条回答
  •  无人及你
    2020-12-01 04:43

    I did the following...

    1. place your css file in the app/assets/stylesheets folder.
    2. Add the stylesheet link <%= stylesheet_link_tag "filename" %> in your default layouts file (most likely application.html.erb)

    I recommend this over using your public folder. You can also reference the stylesheet inline, such as in your index page.

提交回复
热议问题