如何将供应商资源添加到application.css并在网页中引用?
How to add vendor resources to application.css and reference it in web page?
我正在使用 rails 4,并在 vendor/assets/bower_components
目录中使用 bower 安装资源,例如,bootstrap 在 /vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css
.
中
我将 require bootstrap/dist/css/bootstrap
添加到 app/assets/stylesheets/application.css
,但是当我查看页面时,它显示 couldn't find file 'bootstrap/dist/css/bootstrap'
(in /home/vagrant/Share/webapp/app/assets/stylesheets/application.css:15)
而且我想知道如何在 rails 中引用这些资源。
在您的 application.css 文件中试试这个。希望对你有帮助。
*= require_tree ../../../vendor/assets/bower_components/.
将 config.assets.paths << Rails.root.join('vendor', 'assets', 'bower_components')
添加到 config/application.rb
并重试。
我正在使用 rails 4,并在 vendor/assets/bower_components
目录中使用 bower 安装资源,例如,bootstrap 在 /vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css
.
我将 require bootstrap/dist/css/bootstrap
添加到 app/assets/stylesheets/application.css
,但是当我查看页面时,它显示 couldn't find file 'bootstrap/dist/css/bootstrap'
(in /home/vagrant/Share/webapp/app/assets/stylesheets/application.css:15)
而且我想知道如何在 rails 中引用这些资源。
在您的 application.css 文件中试试这个。希望对你有帮助。
*= require_tree ../../../vendor/assets/bower_components/.
将 config.assets.paths << Rails.root.join('vendor', 'assets', 'bower_components')
添加到 config/application.rb
并重试。