test_app /应用/资产/样式表/ application.css.scss
@import 'compass';
@import 'variables';
@media only screen and (min-width: $breakpoint-medium-additional-width) {
@import 'partials/medium-additional';
}
test_app /应用/资产/样式表/ _variables.scss
$breakpoint-medium-additional-width: 28em;
当我尝试访问某个页面(正在开发中)时,会发生此Rails错误:
Sass::SyntaxError at /
Invalid CSS after "...nd (min-width: ": expected expression (e.g. 1px, bold), was "$breakpoint-med..." (in /Users/ben/rails_projects/test_app/app/assets/stylesheets/application.css.scss)
为什么$breakpoint-medium-additional-width
设置不正确?
我正在使用
答案 0 :(得分:1)
我认为你的代码中有拼写错误。我创建了一个新的rails项目,它对我来说很好。
app / assets / stylesheets / _variables.scss
$breakpoint-medium-additonal-width: 28em;
应用程序/资产/样式表/ application.scss
@import 'compass';
@import 'variables';
@media only screen and (min-width: $breakpoint-medium-additonal-width) {
font-size: 120%;
}
输出application.css
@media only screen and (min-width: 28em) {
font-size: 120%;
}