我正在尝试升级一系列宝石,以便获得当前的支持。但是,无论何时尝试,我都会在applications.html.erb上开始接收HTML1506。在stylesheet_link_tag和javascript_include_tag之间出现问题,其中“ / body”后跟“ script”。两者均已生成,因此我似乎无法解决该问题。
我要升级的宝石包括:
Successfully installed sprockets-3.4.0
Successfully installed sprockets-rails-2.3.3
Successfully installed sass-rails-5.0.4
Successfully installed bootstrap-sass-3.3.5.1
Successfully installed jquery-rails-4.0.5
我得到的错误是:
来自更好的错误:
Invalid CSS after "...les.responsive'": expected "{", was ";"
从F12控制台:
HTML1506: Unexpected token.
从F12调试器:
</section>
</body>
<script>
(function() {
我了解之后在语法上是不正确的。但是,我都不生成它们!
applications.html.erb是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="me-at-gmail.com">
<link href="<%= image_path("item.ico") %>" rel="icon" type="image/png">
<link rel="apple-touch-icon" sizes="128x128" href="apple-touch-icon.png">
<title><%= content_for?(:title) ? yield(:title) : "Default title..." %></title>
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Key and Car Tracking" %>">
<%= puts "Action#Controller is " + @_request.filtered_parameters['action'] + "#" + @_request.filtered_parameters['controller'] %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js", "application", "data-turbolinks-track" => true %>
<% csrf_meta_tags %>
<% #render 'layouts/shim' %>
</head>
<body>
<noscript>
For full functionality of this site it is necessary to enable JavaScript.
Here are the <a href="http://www.enable-javascript.com/" target="_blank">
instructions how to enable JavaScript in your web browser</a>.
</noscript>
<header>
<%= render 'layouts/navigation' %>
</header>
<main role="main">
<%= render 'layouts/messages' %>
<div class="container-fluid">
<div class="row">
<%= yield %>
</div>
</div>
<h5 style='color: #97b3fc'>Beta Test version. Not for production. Copyright 2015©</h5>
<a rel="license" class='hidden' href="http://www.example.com/">Copyrighted 2015</a>
</main>
<%= debug(get_route_pattern) if Rails.env.development? %>
<%= debug(request.class) if Rails.env.development? %>
<%= debug(params) if Rails.env.development? %>
</body>
</html>
最佳答案
Yule的技巧帮助我找到了错误。奇怪的是,我认为样式表是有效的,因为它在升级之前就可以使用。当我注释掉一些代码时,其中有一个错字导致了问题,如下所示:
/*
@import 'core';
@import 'datepicker'; /* comments */
@import 'theme'; /* comments */
*/
问题在于,在日期选择器行上的注释之后,第一个* /终止了顶部/ *。这导致最后的* /无效并引发错误。
在SCSS预处理中,这似乎是一个明显的问题,因为它应该捕获这样的错误并提供较少隐秘的错误消息。但是,无论如何,问题现在已经解决。谢谢Yule。