add external style sheet in rails project

前端 未结 2 1343
春和景丽
春和景丽 2021-02-19 02:37

I am using Rails 3.2.1. How do I add external style sheets in my rails application?

I\'ve tried the following answers to no avail:

  • How do I link to an exte
相关标签:
2条回答
  • 2021-02-19 03:17

    I'm just going to assume you're already using something like this in your layout:

    stylesheet_link_tag 'application'

    If you want to refer to an external stylesheet then all you need to do is pass in the url.

    stylesheet_link_tag 'application', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css'

    If you want to include the actual files in your codebase:

    app/assets/stylesheets is where you should place your main css files.

    vendor/assets/stylesheets is where you should place the css files for any plugins that you might have.

    It's the same for js files. For example your application.js would go in app/assets/javascripts and a jquery plugin like timeago.js would go in vendor/assets/javascripts.

    0 讨论(0)
  • 2021-02-19 03:19

    After looking for a solution to this problem for a while, I found this step by step tutorial which explain how to implement a bootstrap theme to a rails app => http://www.notch8.com/implementing-a-bootstrap-theme/

    You can apply this to other CSS and JS templates than a Bootstrap one.

    Hope this help (sorry if I make english mistakes)

    0 讨论(0)
提交回复
热议问题