简体   繁体   English

Rails 4 + Bower-Rails宝石+ Bower + Bootstrap Sass

[英]Rails 4 + bower-rails gem + bower + bootstrap sass

I have installed bower-rails gem 我已经安装了凉亭栏杆宝石

then in bower file I included bootstrap-sass, it installed bootstrap-sass in vendor/assets/bower_components. 然后在Bower文件中,我包含bootstrap-sass,它在vendor / assets / bower_components中安装了bootstrap-sass。

Now according to a resource bower-rails automatically takes care of adding bower_components to assets, so I am trying this in application.css 现在根据一种资源,bower-rails自动负责将bower_components添加到资产,因此我正在application.css中尝试

 *= require_tree .
 *= require_self
 *= require 'bootstrap-sass'
 */

But it throws me error that bootstrap-sass file not found. 但这引发了我找不到bootstrap-sass文件的错误。

Do I have to manually add vendor/assets/bower_components to assets? 我是否必须手动将供应商/资产/ bower_components添加到资产?

I am pretty new to rails so some explanation would help a lot. 我对Rails很陌生,因此进行一些解释会很有帮助。

I am following this resource 我正在关注此资源

EDIT: On doing rails c and printing Rails.application.config.assets.paths I can see vendor/assets/bower_components in asset paths ` 编辑:在做rails c和打印Rails.application.config.assets.paths我可以在资产路径中看到vendor/assets/bower_components

Finally I resolved the issue by removing all the bower components and running 最后,我通过删除所有Bower组件并运行来解决了该问题。

rails g bower_rails:initialize

It created an intializer for assets bower_rails.rb, which finally solved the problem 它为资产bower_rails.rb创建了一个初始化器,最终解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM