如何在多个 CssResource css 文件中使用相同的 @def?
我想说,在一个集中的位置,
@def mainColor = #f00;
然后在我的所有其他 css 文件中,引用 mainColor
而无需重新定义它。然后,当我在一个地方更改 mainColor 时,我的整个应用程序都会改变颜色。
到目前为止,我能想到的最好方法是为每个 CssResource 声明包含两个 @Source
文件,并始终包含全局 def 文件。还有其他方法吗?
I'd like to say, in a single, centralized location,
@def mainColor = #f00;
and then, in all of my other css files, refer to mainColor
without having to redefine it. Then when I change mainColor in once place, my entire app changes color.
The best way I can think of so far is to include two @Source
files for every CssResource declaration and always include the global def file. Are there any other ways?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,这是您唯一的选择:
style.css
*.ui.xml
这样做的缺点是相对路径。每个 ui.xml 都需要不同的 src 路径。
或者,如果您不介意使用 Constants.java 文件(而不是 css),
你可以使用@eval
As far as I know, this is your only option:
style.css
*.ui.xml
The downside to this is the relative path. Each ui.xml will require a different src path.
Alternatively, if you dont mind using a Constants.java file (instead of css),
you could use
@eval