Forum Moderators: not2easy
I'd use macros a.o. to define my colors for the scheme I'm doing and reuse them without hunting down the right color every time.
Actually I'm contemplating on getting the macro's myself by processing the CSS through a script, doesn't even have to be dynamic, just generate the production CSS.
are you talking about CSS Constants? if so I believe there is a proposal being written for them..
w3.org archives for meeting held in March [w3.org]
Constants
Clear use case for importing colors from a site-wide style sheet. CSSWG wants more concrete use cases for anything beyond that.fantasai points to webstandards.org comments and suggests macros for selectors, values, and declaration sets would fulfill most requests there.
CSSWG will post a simple proposal macros for values only, and see if that will cause web designers to post real examples of where more powerful macros are needed.
and I see now that the selectors thing I wish for is mentioned in there too although the proposal appears to be only going to written for values, not selectors
[edited by: SuzyUK at 5:33 pm (utc) on May 31, 2008]
Perhaps my age and unix background will show when I point to m4 as "macro language processor". It's a fairly widespread tool in unix installations that's pretty powerful.
Quote from the manpage:
The m4 utility is a macro processor that can be used as a front end to any language (e.g., C, ratfor, fortran, lex, and yacc). m4 reads from the standard input and writes the processed text to the standard output.
But its capabilities are way more advanced than the minimum I'm looking for: define variables and have them substituted in the text.
It can also do math, if/then/else, includes, regular expressions, ...
Why I called it simple is mainly because it can do it considering css as text, it has no need to understand the "language" that CSS is.
If you want to have a look at using m4 in the context of html (but it would work for CSS just as well). Note this is ancient (1997), but I bookmarked it a while ago as a source of inspiration: [linuxgazette.net...]
(I'm not affiliated with anything creating that)
What I was thinking about:
While you could make a system to generate css with m4 without even knowing css at all, that's not what I want to achieve.
[It can be done: the sendmail.cf file used to be the sysadmin nightmare for many an admin till they started to generate those files with m4, nowadays it's childsplay to get them generated for you in most cases]
I realised that, in fact I felt so daft I asked the 'moderator' to remove my post.. and now we've cross posted :o
Thanks v.much for your patience and explanation.. plenty there to read and digest - I too am trying to write myself a script (though probably php)which will parse CSS files extract 'constants', strip comments, generally tidy up.. just something I can use for myself