0

我已经进行了一些研究,但响应通常缺少解决问题的必要细节,或者在没有解释的情况下发现了解决方案。例如,一个人“手动”检查了他的 css.scss 文件并发现了问题。我是编程新手,所以我不确定如何复制该过程。无论如何,这里是错误消息和我使用的代码:当我安装引导程序并尝试刷新页面时,我收到了这个错误。

Sass::SyntaxError in Pages#home

显示 /Users/vrobles50/code/omrails1/app/views/layouts/application.html.erb 其中第 5 行提出:

找不到或无法读取要导入的文件:引导程序。加载路径:Sass::Rails::Importer(/Users/vrobles50/code/omrails1/app/assets/stylesheets/styles.css.scss) (在/Users/vrobles50/code/omrails1/app/assets/stylesheets/styles .css.scss) 提取的源代码(第 5 行附近):

2: 
3:


4: One Month Rails1
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: 
Rails.root: /Users/vrobles50/code/omrails1

Styles.css.scss:

@import 'bootstrap';

@import 'bootstrap-responsive';
************************************************
Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'
gem 'jquery-rails'

group :production do
gem 'pg'
end

group :development, :test do
gem 'sqlite3'
end

group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-sass', '~> 2.3.1.0'
end
************************************************
Application.html.erb:

<!DOCTYPE html>



One Month Rails1
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>


<%=render 'layouts/header' %>

<%= yield %>
<%=render 'layouts/footer' %>
    </body>
4

2 回答 2

0

尝试将其@import 'bootstrap'放入 application.sass,如下所示:

// app/assets/stylesheets/application.sass

@import 'bootstrap'
@import 'application/*'

其中 application 应该是app/assets/stylesheets/application/包含所有 sass 文件的目录。

此外,您可能已经注意到,application.sass 在创建项目时替换了由 rails 自动生成的 application.css,因此请确保您也导入了在那里导入的任何内容。

于 2013-05-11T17:16:51.027 回答
0

After placing the bootstrap-sass gem in your gemfile did you run bundle install in the terminal? And then you need to restart your server. Did you already do those things?

The only other thing that stands out to me right now is your application.html.erb page. Everything should be wrapped in html tags and your "One Month Rails1" is not inside any tags. Here's an example application.html.erb page in case you edited yours and may need to fix it: https://gist.github.com/flores8/5573450

于 2013-05-14T03:27:30.063 回答