Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets

前端 未结 15 1387
眼角桃花
眼角桃花 2020-11-30 03:40

I am suddenly getting this error in development and in production on deployment.

custom.css.scss

@import \"bootstrap-sprockets\";
@import \"bootstrap         


        
15条回答
  •  一整个雨季
    2020-11-30 04:13

    This is how I solved the issue.

    Go to Bootstrap for Sass Github page and follow the instructions:

    1. Add the following to the Gemfile

      gem 'bootstrap-sass', '~> 3.3.6' gem 'sass-rails', '>= 3.2'

    2. Run the command bundle install

    3. Start/restart the server

      rails s

    Also, make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it. Then, remove all the *= require_self and *= require_tree . statements from the sass file. Instead, use @import to import Sass files.

提交回复
热议问题