【问题标题】:Rails Assets:Precompile Failure, Invalid CSSRails 资产:预编译失败、无效的 CSS
【发布时间】:2013-12-19 22:23:43
【问题描述】:

运行时

rake assets:precompile

我收到以下错误:

““...it-box-shadow:”后的无效 CSS:预期表达式(例如 1px,粗体),为“:inset 0 -1px 0...”

有问题的 css 在 bootstrap.css 中:

.form-control {
  display: block;
  width: 100%;
  height: 34px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.428571429;
  color: #555555;
  vertical-align: middle;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 4px;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
  transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}

此设置贯穿于 bootstrap.css 文件中,取自 WrapBootstrap 主题。语法看起来是正确的,所以我不明白为什么预编译失败。

application.css.scss:

*
*= require jquery.ui.all
*= require bootstrap
*= require animations
*= require font-awesome
*= require font-awesome-ie7
*= require graph
*= require ie
*= require nivo-slider
*= require prettyPhoto
*= require pricing-table
*= require settings
*= require style
*= require spectrum
*= require superfish
*= require switcher
*= require team-member
*= require theme-responsive
*= require colors/red
*= require video-js
*= require_self
*/

.contact{
  padding-top: 50px;
}

是我遗漏了什么还是这不是有效的语法?

【问题讨论】:

    标签: css ruby-on-rails-3 twitter-bootstrap-3


    【解决方案1】:

    添加引导 gem 时,您应该指定版本。您安装的版本可能与正在使用的引导 CSS 不同。引导程序一直在变化。

    附带说明,运行 rake assets:clean && rake assets:precompile

    【讨论】:

    • 如果我已将 bootstrap.css 和 bootstrap.js 包含在适当的样式表和 js 目录中,是否需要安装 Gem?在运行预编译之前,我一直在运行 rake assets:clean。
    • 适当的目录将在供应商下。然后像上面一样在你的 application.js 文件中包含 *= require bootstrap.js 但输入整个文件名
    • 更新:我删除了 bootstrap.css 和 bootstrap.js,添加了 bootstrap-sass v 3.0.3.0,捆绑,从 repo 中删除了所有旧文件,rake assets:clean,rake assets:precompile 和问题依然存在。
    • 我经历了一系列变化,但我不确定解决方案是什么。我很沮丧,刚开始以非顺序的顺序做一堆东西,但它现在正在工作。我想我已经把它缩小到两件事之一,你也许可以告诉我哪一个是罪魁祸首。要么是推送到 Git 的过去预编译的资产。我从公共中删除了所有资产。或者是 Modernizr 的版本问题。无论哪种方式,您的建议都使我查看了 Modernizr 的版本。 Modernizr 的版本会是问题吗?
    • 这取决于给您错误的文件的名称。编译并发送错误时,请查看 css 错误在哪个文件中。如果它在引导 css 文件中,那么它的引导程序。对于这个问题,您尝试添加的是否是新的 css 文件?还是您只是想让它第一次工作?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-17
    • 2021-11-12
    • 2014-06-27
    • 1970-01-01
    相关资源
    最近更新 更多