【发布时间】:2012-12-04 06:52:08
【问题描述】:
我在我的 Rails 应用程序中使用 .scss 文件,之前我使用的是:
@import "bootswatch/superhero/variables";
@import "bootswatch/superhero/bootswatch";
但我想做这样的事情:
$theme: 'superhero';
@import "bootswatch/#{$theme}/variables";
@import "bootswatch/#{$theme}/bootswatch";
不幸的是,这不起作用,变量没有被嵌入。当我想更改主题时,如何才能避免更改我的application.css.scss 太多次?
其他没有成功的尝试
@import "bootswatch/" + $theme + "/variables";
$theme_variables: "/bootswatch/#{$theme}/variables";
@import $theme_variables;
【问题讨论】:
-
@import "bootswatch/" + $theme + "/variables"; 怎么样?
-
也不好,该死。这是一个很好的猜测!
Invalid CSS after "... "bootswatch/" ": expected selector or at-rule, was "+ $theme + "/va..." -
关于整个主题理念:您是否考虑过让每个主题仅包含一些变量和/或 mixins,并(尽可能)在主题独立代码中使用它们?
-
我正在使用
bootswatch-railsgem。他们已经添加了所有的主题和诸如此类的东西,并且可能正在尽可能多地使用 mixins。我只是希望有一种更简单的方式来改变主题(不像现在的方式很难!)
标签: stylesheet sass