Combres 和 Dotlesscss 是否可以让多个 CSS 文件重用相同的变量?
我已经使用 Combres 一段时间了,非常喜欢它。现在我也开始使用 Dotlesscss 过滤器来启用变量和更具可读性的代码,希望这些代码可以保持干净和可读...
Combres 的一个很好的优点是,将大型 CSS 文件拆分为具有不同职责的多个文件,这真的很好。
我的问题是将其结合起来以利用 Combress 和 Dotlesscss。
我想要一个 variables.css
文件,其中包含我需要在网站上设置颜色等的所有基本变量,但是 Combres 组合、过滤和压缩 CSS 文件的方式似乎是这个顺序:
过滤器->结合-> compress
这当然意味着单独的CSS文件不知道其他CSS文件中定义了哪些变量,所以如果我想要到处都是一种颜色,我就必须在所有CSS文件中为其添加一个变量。
如果可以将顺序更改为:
组合 -> 那就太好了。过滤器-> 这样我就可以拥有一个 variables.css
,其中所有变量都在一个文件中,并且它们的使用分布在多个文件中。这意味着如果我想更改样式,我只需要在变量定义文件中进行修改即可。
是否可以更改 Combres 执行这些操作的顺序?
I've used Combres for a while and really like it. And now I've started to use Dotlesscss filter as well to enable variables and more readable code that can hopefully stay clean and readable...
One nice advantage with Combres is that splitting large CSS files into several files with different responsibilities is really nice.
My problem is combining this to take advantage of both Combress and Dotlesscss.
I would like to have a variables.css
file with all basic variables I need to set colors, etc. on the my site, but the way Combres combines, filters and compress the CSS files seems to be in this order:
filter -> combine -> compress
which of course means that separate CSS files have no idea what variables are defined in other CSS files, so if I want one color everywhere, I would have to add a variable for it in all CSS files.
It would be nice if it was possible to change the order to:
combine -> filter -> compress
That way I could have a variables.css
with all variables in one files and the usage of them spread across multiple files. This would mean that if I wanted to change styling, I would only need to mess around in the variable definition file.
Is it possible to change the order Combres does these things?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是《Combres》的作者。可以在组合步骤之后应用过滤器。您所要做的就是实现接口
ICombinedContentFilter
并放置必要的过滤逻辑。 Combres 具有内置过滤器,支持单文件无点应用程序 (DotLessCssFilter
) 和组合无点应用程序 (DotLessCssCombineFilter
)。只需为您的资源集注册DotLessCssCombineFilter
即可。I'm the author of Combres. It is possible to apply the filter after combination step. All you have to do is implement the interface
ICombinedContentFilter
and put necessary filtering logic. Combres has built-in filters supporting both single file dotless application (DotLessCssFilter
) and combined dotless application (DotLessCssCombineFilter
). Just registerDotLessCssCombineFilter
for your resource set and that should be it.