Sass部分导入 [英] Sass partial importing

查看:106
本文介绍了Sass部分导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有关sass编译的问题。

I have an issue with sass compilation.

当我有一个部分 _partial.scss 并且将它导入到多个部分文件中(因为它包含颜色变量),它将在编译的css中多次出现!

When I have a project with a partial _partial.scss and have it imported in multiple partial files (because it contains color variables) it will end up in the compiled css multiple times!

这是丑陋的, overrule本身多次,这使得调试信息(chromium dev工具/ firebug)更不可读。

This is ugly because the same rule will 'overrule' itself multiple times which makes debugging info (chromium dev tools / firebug) rather unreadable.

我认为有一个解决方案。

I presume there is a solution for all this. I just can't find anything on the issue, anywhere.

推荐答案

解决方案不包括多次相同的文件或没有任何代码直接输出CSS在您计划包括多次的文件。如果你的变量本身在一个文件中,它们可以安全地包含在任何你想要的地方,而不用选择器重复。

The solution is to either not include the same file multiple times or don't have any code that directly outputs CSS in the file you're planning on including more than once. If your variables were in a file by themselves, they could be safely included anywhere you'd like without selector duplication.

这篇关于Sass部分导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆