I'm trying to add bootstrap to my ror application.
I have included this gem
gem 'bootstrap', '~> 4.0.0.beta2.1'
Bundled Installed this
Renamed my css file as a .scss
@import "bootstrap";
And I get this error when I run my project
Error: File to import not found or unreadable: bootstrap. on line 1 of /home/ubuntu/workspace/shc-pms/app/assets/stylesheets/application.scss
1: @import "bootstrap";
Note: If you use bootstrap-sprockets (@import "bootstrap-sprockets";)
, you will get the error:
File to import not found or unreadable: bootstrap-sprockets
Gemfile
gem 'bootstrap', '~> 4.0.0'
Ensure that sprockets-rails
is at least v2.3.2
.
Remove:
*= require_tree .
*= require_self
from application.scss
. Use @import
to import sass file. Add:
@import "bootstrap";
to application.js. It will now look like this:
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require_tree .
Restart the server, see what's happening.
I fixed it by deleteing everything from css/scss files. Deleting scss file. Using the gem - gem 'bootstrap', and linking the cdn to my application.html.erb file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.