[英]Bower and Rails Asset Pipeline Import
I have used Bower to install a selection of components into my Rails app. 我已经使用Bower在我的Rails应用程序中安装了一系列组件。
The components are in /app/vendor/assets/components
组件位于/app/vendor/assets/components
I have installed the hidpi scss file and that lives at: 我已经安装了hidpi scss文件,该文件位于:
/app/vendor/assets/components/sass-hidpi/_hidpi.scss
Now, I need to get that scss file imported into my main application.css.sass file which lives in /app/assets/stylesheets
现在,我需要将该scss文件导入到我的主application.css.sass文件中,该文件位于/app/assets/stylesheets
I have tried: 我努力了:
@import url(<%= asset_path '_hidpi.scss' %>)
by adding .erb onto the end of my application.css.sass file but that just outputs: 通过将.erb添加到我的application.css.sass文件的末尾,但这只会输出:
@import "/assets/_hidpi.scss"
in my compiled stylesheet which obviously is wrong. 我@import "/assets/_hidpi.scss"
样式表中的@import "/assets/_hidpi.scss"
显然是错误的。
How can I get the file imported and compiled without moving it from the components directory that bower installs to? 如何将文件导入并编译,而不将其从安装Bower的components目录中移出?
You can try adding the following to config/application.rb
, inside the class Application < Rails::Application
block: 您可以尝试在class Application < Rails::Application
块class Application < Rails::Application
config/application.rb
添加以下内容:
config.sass.load_paths << File.expand_path('../../vendor/assets/components/')
from SASS, Rails 3.1: Loading stylesheets in vendor/assets 从SASS,Rails 3.1:在供应商/资产中加载样式表
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.