HTML1506:带有stylesheet_link_tag

时间:2015-10-21 16:01:06

标签: javascript html css ruby-on-rails stylesheet

我正在尝试升级一系列宝石,以便获得当前的支持。但是,每当我尝试这个时,我就开始在applications.html.erb上接收HTML1506。 stylesheet_link_tag和javascript_include_tag之间出现问题,其中" / body"之后是"脚本"。两者都是生成的,所以我似乎无法解决这个问题。

我正在升级的宝石包括:

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&copy;</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>

1 个答案:

答案 0 :(得分:0)

尤尔的小费帮我找到了错误。奇怪的是,我认为样式表是有效的,因为它在升级之前有效。当我注释掉一些代码时,它中出现了一个错误导致问题,如下所示:

/*
@import 'core';
@import 'datepicker';  /* comments */
@import 'theme';       /* comments */
*/

问题是,在datepicker行注释之后的第一个* /终止了top / *。这导致最终* /无效并抛出错误。

这似乎是SCSS预处理中的一个明显问题,因为它应该捕获这样的错误并提供一个不那么神秘的错误消息。但是,无论如何,问题现在已经解决了。谢谢你。