How to maintain css theme files (best practice?) [message #695418] |
Mon, 11 July 2011 17:25 |
Nikolai Raitsev Messages: 102 Registered: July 2009 |
Senior Member |
|
|
Hello RAP community.
If you try to define your own theme based on css, so you will realize that this task can be complicated: because CSS (and its interpreter in RAP) does not support variables and reuse (I know, its named CASCADING style sheets, not object oriented:).
Fortunately, there are projects such LESS (http://lesscss.org/), Less for Java (LESS for Java) and Ant. With it, it's possible to make more order in your css files and it helps to make it more maintainable: with LESS-variables you can make definitions like colors and fonts only in one place and reuse it on hundreds places in RAP css theme.
Example:
/*@textStandardColor: #222222;*/
@textStandardColor: #222222;
/*Background color definitions*/
/*@backgroundStandardColor: #ffffff;*/
@backgroundStandardColor: #ffffff;
List,Tree,Table,Text,Spinner,Combo,DateTime {
color: @textStandardColor;
background-color: @backgroundStandardColor;
}
will be transformed into:
/*@textStandardColor: #222222;*/
/*Background color definitions*/
/*@backgroundStandardColor: #ffffff;*/
List,Tree,Table,Text,Spinner,Combo,DateTime {
color: #222222;
background-color: #ffffff;
}
Unfortunately Less Engine has no Ant task, so I created my own. In Attachment you can find an example, how to use it: simply run the build.xml.
Best regards,
Nikolai
|
|
|
|
Powered by
FUDForum. Page generated in 0.04682 seconds