2015-03-14 2 views
0

Был тот же вопрос в Rails loads all stylesheets except application.css.scss, и я поднял эту проблему quesiton.application.css.scss не работал, но другие работали

как описано в названии, все остальные css-файлы работали, а application.css.scss практически не влиял. Когда я говорю «почти», это означает, что после удаления application.css.scss есть небольшие отличия. Мне жаль, что у меня недостаточно репутации для отправки изображений.

Пожалуйста, помогите мне ...

application.html.erb

<!-- START:head --> 
<!DOCTYPE html> 
<html> 
<head> 
    <title>Pragprog Books Online Store</title> 
    <%= stylesheet_link_tag "application", media: "all", 
    "data-turbolinks-track" => true %> 
    <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 
    <%= csrf_meta_tags %> 
</head> 
<!-- END:head --> 
<body class="<%= controller.controller_name %>"> 
    <div id="banner"> 
    <%= image_tag("logo.png") %> 
    <%= @page_title || "Pragmatic Bookshelf" %> 
    </div> 
    <div id="columns"> 
    <div id="side"> 
<!-- START_HIGHLIGHT --> 
     <div id="cart"> 
     <%= render @cart %> 
     </div> 

<!-- END_HIGHLIGHT --> 
     <ul> 
     <li><a href="http://www....">Home</a></li> 
     <li><a href="http://www..../faq">Questions</a></li> 
     <li><a href="http://www..../news">News</a></li> 
     <li><a href="http://www..../contact">Contact</a></li> 
     </ul> 
    </div> 
    <div id="main"> 
     <%= yield %> 
    </div> 
    </div> 
</body> 
</html> 

application.css.scss

/* 
* 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_self 
*= require_tree . 
*/ 

/* START_HIGHLIGHT */ 
#banner { 
    background: #9c9; 
    padding: 10px; 
    border-bottom: 2px solid; 
    font: small-caps 40px/40px "Times New Roman", serif; 
    color: #282; 
    text-align: center; 

    img { 
    float: left; 
    } 
} 

#notice { 
    color: #000 !important; 
    border: 2px solid red; 
    padding: 1em; 
    margin-bottom: 2em; 
    background-color: #f0f0f0; 
    font: bold smaller sans-serif; 
} 

#columns { 
    background: #141; 

    #main { 
    margin-left: 17em; 
    padding: 1em; 
    background: white; 
    } 

    #side { 
    float: left; 
    padding: 1em 2em; 
    width: 13em; 
    background: #141; 

    form, div { 
     display: inline; 
    } 

    input { 
     font-size: small; 
    } 

    #cart { 
     font-size: smaller; 
     color: white; 

     table { 
     border-top: 1px dotted #595; 
     border-bottom: 1px dotted #505; 
     margin-bottom: 10px; 
     } 
    } 

    ul { 
     padding: 0; 
     li { 
     list-style: none; 
     a { 
      color: #bfb; 
      font-size: small; 
     } 
     } 
    } 
    } 
    #time { 
    background: red; 
    color: red; 
    } 
} 

.depot_form { 
    fieldset { 
    background: #efe; 
     legend { 
     color: #dfd; 
     background: #141; 
     font-family: sans-serif; 
     padding: 0.2em 1em; 
     } 
    } 
    form { 
     label { 
     width: 5em; 
     float: left; 
     text-align: right; 
     padding-top: 0.2em; 
     margin-right: 0.1em; 
     display: block; 
     } 
     select, textarea, input { 
     margin-left: 0.5em; 
     } 
     .submit { 
     margin-left: 4em; 
     } 
     br { 
     display: none 
     } 
    } 
    } 
+2

поставить код пожалуйста, вы можете скопировать и вставить код – ppascualv

+0

извините, я забыл, и были добавлены коды. – killernova

ответ

0

Вы можете проверить Diferent думает:

  1. В application.css.scss вы должны включать в себя:

    *= require_self

    *= require_tree

  2. Проверьте, если вы не имеют application.css файл тоже.

  3. На окружающих средах/production.rb вы должны иметь это:

    config.assets.enabled = true

  4. Или что-то подобное, что может помочь вам в application.rb

    config.assets.paths << "#{Rails.root}/app/assets"

+0

делайте то, что вы сказали, и мне не повезло. – killernova

0

Вместо использования '#' use '.' (Как .banner) и использовать

<div class = "banner"> 

вместо

<div id = "banner"> 
+0

Спасибо, но все равно никакой разницы. – killernova

Смежные вопросы