简体   繁体   English

SCSS导入层次结构

[英]SCSS import hierarchy

I want to structure my project CSS in a hierarchy like so: 我想按如下所示的层次结构构建项目CSS:

app {
    interface1 {
        gadget1 {}
    }
}

And I want to split this into numerous smaller CSS files: 我想将其拆分为许多较小的CSS文件:

app.scss
_interface1.scss
_gadget1.scss

Can I import like this: 我可以这样导入吗:

/* app.scss */
app {
    @import 'interface1'
    @import 'interface2'
}

/* _interface1.scss */
interface 1 {
    @import 'gadget1'
}

/* _gadget1.scss */
gadget1 {
    height: 1000px;
    width: 1000px;
    /* ...etc... */
}

Or what is the best way to achieve this end structure? 或实现此最终结构的最佳方法是什么?

Answering my own question: Yes it is possible to do exactly that. 回答我自己的问题:是的,完全可以做到这一点。

Downloaded SASS and tried it. 下载并尝试了SASS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM