我最近参加了一个黑客马拉松,我们在 Rails 中制作了一个 Web 应用程序。我们都是 Rails 新手,不知道 bootstrap gem,因此我们在 assets 文件夹中硬编码了 bootstrap 样式表。
为了进一步学习 Rails,我将继续使用该应用程序。我已删除 .css 文件,并将 gem 添加到我的 Gemfile 中。我已经运行了 bundle install 并在另一个 CSS 文件中使用“@import”命令导入了文件。
当我运行 rails 服务器并导航到我的主页时,我收到一个错误:
Sass::SyntaxError in Pages#rootpage
Showing C:/Users/User/Documents/SoapBox/app/views/layouts/application.html.erb where line #6 raised:
File to import not found or unreadable: bootstrap.
Load paths:
C:/Users/Soham/Documents/SoapBox/app/assets/images
C:/Users/Soham/Documents/SoapBox/app/assets/javascripts
C:/Users/Soham/Documents/SoapBox/app/assets/stylesheets
C:/Users/Soham/Documents/SoapBox/vendor/assets/javascripts
C:/Users/Soham/Documents/SoapBox/vendor/assets/stylesheets
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/turbolinks-1.3.0/lib/assets/javascripts
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts
(in C:/Users/Soham/Documents/SoapBox/app/assets/stylesheets/styles.css.scss:2)
`File to import not found or unreadable: bootstrap`.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='http://fonts.googleapis.com/css?family=Oswald:700,300' rel='stylesheet' type='text/css'>
<%= favicon_link_tag "favicon.png", :type => "image/png", :rel => "icon" %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
我不明白为什么会发生错误。
任何帮助将非常感激!
谢谢!
索汉克