问题描述
我在学习rails。我有这个问题,我希望你能帮助我。
I'm learning rails. I have this problem and I hope you can help me.
这是我的custome.css.scss:
This is my custome.css.scss:
@import "bootstrap";
/* mixins, variables, etc. */
$grayMediumLight: #eaeaea;
/* universal */
html {
overflow-y: scroll;
}
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
/* typography */
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}
h2 {
font-size: 1.2em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $grayLight;
}
p {
font-size: 1.1em;
line-height: 1.7em;
}
/* header */
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: white;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
line-height: 1;
&:hover {
color: white;
text-decoration: none;
}
}
/* footer */
footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $grayMediumLight;
color: $grayLight;
a {
color: $gray;
&:hover {
color: $grayDarker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 10px;
}
}
}
到这个文件,就像按回车(添加一个空行)会使我的应用程序崩溃。
and if I do any change to this file, just like pressing enter (adding an empty line) would make my app crash.
这是我得到的错误
Undefined variable: "$grayLight".
(in C:/Sites/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss:52)
任何帮助。
推荐答案
由于错误告诉你, $ grayLight
作为变量。当你改变一个scss文件,它会自动编译css,并且由于这个变量不存在,你会得到错误。
As the error is telling you, $grayLight
is not defined as a variable. When you change a scss file it will automatically compile the css and since this variable does not exist, you get the error.
你使用 bootstrap -sass
?如果是这样,浅灰色变量实际上是 $ gray-light
。 ( $ grayDarker
也应为 $ gray-darker
)。
Are you using bootstrap-sass
? If so, the "light gray" variable is actually $gray-light
. ($grayDarker
should also be $gray-darker
).
这篇关于rails:对custom.css.scss的任何更改使应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!