【发布时间】:2016-08-24 23:21:51
【问题描述】:
我正在关注有关 twitter bootstrap basics 的截屏视频,以尝试更多地了解引导程序,但由于某种原因,当我转到 localhost 时,我的应用程序没有样式。
我也尝试了 github repo https://github.com/seyhunak/twitter-bootstrap-rails 中的步骤。
我也遵循了this SO post的指令,但是当我添加*= require bootstrap_and_overrides这一行时,它显示FileNotFound错误。
这是我在 Rails 新应用 bootstrap_practice 之后所做的:
rails g scaffold Product name price:decimal --skip-stylesheets
rake db:migrate
# added gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' on gemfile (I have also tried just gem 'twitter-bootstrap-rails'
bundle install
rails g bootstrap:install
我检查了资产,它有必要的资产。
样式表 (application.css)
*
*= require_tree .
*= require_self
*/
JS:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require turbolinks
//= require_tree .
最后,我的 application.html.erb 有
<%= csrf_meta_tags %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
我很确定这就是所需的一切。为什么我在 localhost 上的应用程序没有样式?
【问题讨论】:
-
我更喜欢使用创作者的原创宝石:
https://github.com/twbs/bootstrap-sass它对我来说非常有用.. -
超级基本的问题,但是
twitter-bootstrap-railsgem 与bootstrap-sassgem 有什么区别?他们本质上是不是在做同样的事情(造型),但以前的宝石是“非官方”宝石吗? -
差异是使用 SASS 的官方 gem,但您使用的是 LESS。 SASS vs LESS
标签: ruby-on-rails twitter-bootstrap