Rails 4 + bootstrap set up assets

前端 未结 8 1526
春和景丽
春和景丽 2021-02-04 06:53

I am trying to setup bootstrap on Rails4 using bootstrap-sass and I am getting this famous error:

Sprockets::FileNotFound - couldn         


        
8条回答
  •  遇见更好的自我
    2021-02-04 07:44

    Try this:

    Open config/application.rb, add the following line:

    config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
    

    In your config.ru file, add

     require 'bootstrap-sass'
    

    Rename your application.css.scss to something else e.g. custom_bootstrap.css.scss. I have no idea why it makes a difference but it did in my case.

    Also, from what I understand, by default bootstrap-sass does not require you to add

      //require bootstrap
    

    to your application.js. Apparently it breaks some kind of functionality.

提交回复
热议问题