我正在编写 Michael Hartl Rails 教程(目前是第 7 章)。当我尝试运行服务器时,会出现此消息:
Sass::SyntaxError in Static_pages#home
Showing C:/rails_project/sample_app/app/views/layouts/application.html.erb where line #5 raised:
Invalid CSS after "}": expected "}", was ""
(in C:/rails_project/sample_app/app/assets/stylesheets/custom.css.scss)
Extracted source (around line #5):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: <%= render 'layouts/shim' %>
Rails.root: C:/rails_project/sample_app
Application Trace | Framework Trace | Full Trace
app/assets/stylesheets/custom.css.scss:104
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___917874405_26658636'
来自 application.html.erb 的代码:
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>
我不知道问题出在哪里。错误消息似乎不足以显示 aplication.html.erb 中存在的代码。有人有线索吗?