使用现有的 rails 应用程序添加 twitter-bootstrap-rails [英] Adding twitter-bootstrap-rails with an existing rails app
问题描述
我正在尝试将 twitter-bootstrap-rails 与现有的 rails 应用程序一起使用,并在我刷新页面时收到以下错误.
I am trying to use twitter-bootstrap-rails with an existing rails application and getting the following error when i refreshed the page.
没有要加载的文件 -- 更少(在/app/assets/stylesheets/bootstrap_and_overrides.css.less)
no such file to load -- less (in /app/assets/stylesheets/bootstrap_and_overrides.css.less)
提取的源代码(围绕第 5 行):
Extracted source (around line #5):
2: <html>
3: <head>
4: <title>Tracker</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
知道我做错了什么吗?谢谢
any idea what I am doing wrong? thanks
推荐答案
就我而言,仅重新启动 rails 服务器并不能解决问题.我不得不做以下事情来解决这个问题.
In my case, only re-starting the rails server did not do the trick. I had to do following things to fix the problem.
1. 我需要先安装缺少的 gem.我在 Gemfile 中添加了以下几行:
1. I needed to install the missing gems first. I added following lines to my Gemfile :
gem "therubyracer"
gem "less-rails"
然后在控制台中运行:
bundle install
2. 最后,我必须重新启动我的 rails 服务器.
完成所有这些步骤后,twitter bootstrap 开始使用我的 rails 应用程序.希望这能帮助那些和我遇到同样麻烦的人!
After all these steps, twitter bootstrap started working with my rails app. Hope this helps someone who faces the same trouble that I did !
这篇关于使用现有的 rails 应用程序添加 twitter-bootstrap-rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!