scs变量的静态导入



我在_variables.css中定义了一堆变量。我不想导入整个文件,因为它有一些依赖项。我只想将该文件中的一个变量导入到另一个scss文件中。

有可能吗?

用例

我有两套scs文件。两者都有独立的编译流。对于一组,我在_variables.css中定义了一堆需要的变量。我需要所有这些变量来编译第一组scss文件。现在有了第二组scss文件,它只需要很少的上面定义的变量。目前,我将这几个变量复制到_variables2.scs中并导入它。

你可以做:

_shared_variables.css:

// shared variables here

_variables_one.scss

@import "_shared_variables";
// all variables unique to the first sass file here

sass_one.scss

@import "_variables_one.scss";
// other sass one scss here

sass_to.css

@import "_shared_scss";
// other sass two scss here

最新更新