【问题标题】:in assets:precompile getting following error in rails 4在资产中:预编译在 Rails 4 中出现以下错误
【发布时间】:2014-04-10 21:59:17
【问题描述】:

在 rake 资产期间的 rails 4 中:在生产模式下预编译我收到以下错误。 我在跑步 : rake 资产:预编译 RAILS_ENV=production

错误:

在 application.css 文件中搜索,但一切看起来都很干净。我不确定我在哪里错过了这些符号。有什么方法可以检查我到底错过了哪个文件?

这是我完整的 application.css 文件:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require social-share-button
 *= require jquery.tagsinput
 *= require_tree .
 *= require_self
*/


.blog_post{
    margin-left: 5%;
    width: 75%;
}

.blog_component{
    margin-top: 2%;
}

.entry-title{ 

}
.post_title{

    color: #000000;
    font-family: cursivefont;
    font-size: 52px;
    height: 119%;
    line-height: 155%;
    margin-left: 20%;
    position: relative;
    text-align: center;
    width: 60%;
}

.left_content{
    width: 50%;
    margin-left: 10%;
    font-family: roboto_normal;
    /*margin-top: 5%;*/
    float:left;
}

.right_content{
     border: 1px solid;
    float: right;
    margin-right: 10%;
    padding: 2%;
    width: 20%;
    /*font-family: roboto_normal;*/

}

.right_content > .recent_post {
    /* font-family: roboto_normal;
    font-size: 195%;
    font-weight: bold;*/
    font-family: roboto_normal;
    font-size: 190%;
    font-weight: bold;
    padding: 0 8% 8%;
    text-align: center;
    text-transform: uppercase;
}
.footer_section{
    float: left;
    width: 70%;
}

@font-face
{
font-family: cursivefont;
src: url(Antonio-Bold.ttf);
}

@font-face{
    font-family: roboto_normal;
    src: url(RobotoCondensed-Light.ttf);
}

*::selection {
  background: #cc0000;
  color: #ffffff;
}
*::-moz-selection {

  background: #000000;
  color: #ffff00;
}
*::-webkit-selection {

  background: #cc0000;
  color: #ffffff;
}


.comment-section{

    margin-left: 15%;
}

.complete_comment{
    background-color: #F8F8F8;
    border: 1px dashed;
    margin: 2%;
    padding: 3%;
}
.user-comment{
    font-family: roboto_normal;
    margin: 30px 8px 8px;
    padding: 1px;
    width: 80%;
}

.commenter {

    font-weight: bold;
    font-size: 18px;
    margin-left: 2%;
    text-decoration: underline;
    text-transform: uppercase;
}


.comment{
    margin-left: 5%;
    font-size: 16px;
}

.test{
    padding: 10%;

}

#error{
    padding: 10%;
}

【问题讨论】:

  • 发布你的 application.css 文件
  • 它太长了.. 不适合这个文本字段。我可以在哪里分享?
  • 已发布,立即查看@BSpiros
  • 乍一看找不到错误,但我会建议您清理代码。看看mdo.github.io/code-guide/#css-syntax

标签: ruby-on-rails production ruby-on-rails-4.1


【解决方案1】:

尝试rake assets:clean,然后再次尝试预编译。顺便说一句,你想把它推到哪里?

【讨论】:

  • 在本地推送到亚马逊 ec2.. 如果我将在生产模式下运行,它也会给出相同的错误。请帮忙。我遇到了可怕的问题。
  • 任何方法来准确识别它在哪个文件中出现错误,我认为所有文件都被视为 application.css 文件.. ?
  • 也许一次删除一个并尝试编译?另外,也许更快,也许尝试在每个 .css 文件中搜索左右括号并检查不匹配的数字?
【解决方案2】:

解决此类 CSS 问题的最佳方法。 在此处验证您的 css 文件,它将列出所有语法错误。

http://jigsaw.w3.org/css-validator/validator

它解决了我的问题,缺少语法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-17
    • 2014-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多