How to include twitter bootstrap in my Rails project manually (without using any gems)?

前端 未结 5 1792
野的像风
野的像风 2021-01-07 03:28

I\'m learning Rails and want to play with Rails and Twitter Bootstrap. My Rails project layout is:

├─assets
│  ├─images
│  ├─javascripts
│  └─stylesheets
├─c         


        
5条回答
  •  囚心锁ツ
    2021-01-07 04:08

    I ran into the same trouble, and didn't want to have to install gems, etc.

    There's a much easier solution.

    Just override the icon selectors for background image in your custom CSS.

    [class^="icon-"], [class*=" icon-"] {
      background-image: url("/assets/img/glyphicons-halflings.png");
    }
    [class^="icon-white"], [class*=" icon-white"] {
      background-image: url("/assets/img/glyphicons-halflings-white.png");
    }
    

    Put the glyphicons PNGs in app/assets/images/img/ (or wherever you want) and you're done.

提交回复
热议问题