[英]Bower, Bootstrap and sass-rails gem, error: “File to import not found or unreadable: bootstrap”
In short I am trying to find out why I get the error: 简而言之,我试图找出导致错误的原因:
File to import not found or unreadable: bootstrap
This is the full description: 这是完整的描述:
1) I am managing my Javascript libraries using Bower, so I put bootstrap dependency inside the bower.js: 1)我正在使用Bower管理我的Javascript库,因此我将bootstrap依赖项放入bower.js中:
...
"dependencies": {
"bootstrap": "~3"
}
...
and I inserted in application.rb 我插入了application.rb
config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
2) Rails4 is using the gem 'sass-rails' to manage Sass: 2)Rails4使用gem'sass-rails'管理Sass:
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
3) I also added 3)我还加了
@import "bootstrap";
.field_with_errors {
@extend .has-error;
}
to make bootstrapt-compatible with the rails-forms (see https://gorails.com/blog/trying-out-bootstrap-3-0 ) 使Bootstrapt与rails-forms兼容(请参阅https://gorails.com/blog/trying-out-bootstrap-3-0 )
What I get is the error: 我得到的是错误:
File to import not found or unreadable: bootstrap.
找不到或不可读的导入文件:引导程序。
Apart from the specific error, It would be really appreciate an explanation about Bower and sass-rails can collaborate together without problem (I didn't find any good resource on the web). 除了特定的错误之外,我们非常感谢您提供有关Bower和sass-rails可以毫无问题地协作的说明(我在网络上找不到任何好的资源)。
Open your /assets/stylesheets/application.css
file and add the following line: 打开
/assets/stylesheets/application.css
文件并添加以下行:
*= require bootstrap-sass-official/assets/stylesheets/bootstrap.scss
The application.css
file must contain the directives which indicate which resources should be loaded by your application. application.css
文件必须包含指示您的应用程序应该加载哪些资源的指令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.