Forum Moderators: not2easy

Message Too Old, No Replies

@group CSS selectors - anything like it yet

         

SuzyUK

3:37 pm on May 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



a wish list thought ..

rather than


#page div#content div#post a {}
#page div#content div#post p {}
#page div#content div#post ul {}
#page div#content div#post li {}

how about


@group #page div#content div#post {
a {}
p {}
ul {}
li {}
}

would help keep it together and that specificity thing in check...

appi2

4:13 pm on May 30, 2008 (gmt 0)

10+ Year Member



OK
can I have previous sibling
div:hover - div - div {}

swa66

9:25 pm on May 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd honestly rather just see simple text level macros, not something IE can mess up again.

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.

SuzyUK

5:31 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sorry, swa (last replied deleted) I thought you were talking about something completely different, as in we would have to script macros :o doh..

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]

SuzyUK

5:36 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



appi, previous sibling, parent selectors etc.. loads of requests for that (add me too ;)) - apparently there's a problem with implementing them especially when dynamically inserted elements are involved, same as + (adjacent sibling) selector..

oh well we can still wish can't we..

swa66

5:41 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Whatever MSFT calls "macros": I wasn't talking about that at all.

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:

  • write my CSS with m4 macros in them
  • write a small cgi script to hand me a parsed css file back for development purposes
  • once the css is done, generate the css statically on the server and let the webserver use the static file, removing all overhead, and all chances of the browser messing it up

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]

SuzyUK

5:50 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Whatever MSFT calls "macros": I wasn't talking about that at all.

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