为什么Compass@import在Rails中不起作用



test_app/app/assets/stylesheets/application.css.scss

@import 'compass';
@import 'variables';
@media only screen and (min-width: $breakpoint-medium-additional-width) {
  @import 'partials/medium-additional';
}

test_app/assets/stylesheets/_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设置不正确?

我正在使用

  • 轨道3.2.11
  • 红宝石1.9.3
  • 指南针0.12.2
  • 罗盘导轨1.0.3

我认为您的代码中有一个拼写错误。我创建了一个新的轨道项目,它对我来说很好

app/assets/stylesheets/variables.css

$breakpoint-medium-additonal-width: 28em;

app/assets/stylesheets/application.scss

@import 'compass';
@import 'variables';
@media only screen and (min-width: $breakpoint-medium-additonal-width) {
  font-size: 120%;
}

输出应用程序.css

@media only screen and (min-width: 28em) {
  font-size: 120%;
}

相关内容

  • 没有找到相关文章

最新更新