Re: [WSG] css variables
Drake, Ted C. wrote: Here’s the deal. I have a main navigation css. I’d like to create an alternate template and instead of replacing the nav.css with a new flavored nav.css, I’d like to put my color rules in a theme css file. Since I've only glanced at the solutions referred to in some of the other post, I might be wrong, but it seems that they all break the caching aspect of CSS as well as requiring the re-parsing of the style sheet each time. There is no need for this to happen. For starters, have mod_rewrite redirect all CSS requests to the template engine and have the desired style sheet as a query string. The style sheet template and values to be inserted can be stored either as files, in a database, or a combination. The engine pulls the time stamp from the template and the values, compares them to the time stamp in the HTTP headers, sets the outgoing headers to reflect if it's sending a style sheet or not, and finally, parses the template only if needed. This technique can be extended (and possibly abused) to take advantage of other header, cookie, or session info. Another option is store frequently accessed style sheets on the server pre-parsed. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
Hassan Schroeder wrote: Terrence Wood wrote: Constants and variables are not going to part of CSS any time soon, so you will need some kind of server side solution ... AFAIK they all use seom form of regex to do the replacement Well, no -- I frequently use variables in style sheets built in JSP, especially early on in development. And there it's simple Expression Language (EL) variable substitution, so something like this: a:hover, a:focus { color: ${contrastColor}; } can be evaluated per site, per session, or even per request, making it really easy to test, tune, and/or customize... FWIW! You can also do almost the same thing with PHP just do the following: ?php $variable=do your declarations here; $bg=#fff $h1=100; $w1=20em; header('Content-Type: text/css'); echo html{ color:#123; background:$bg; } #header{ height:{$h1}px; width:$w1; } ; ? note that it's important that there are double quotes on the echo and not single. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
Drake, Ted C. said: There was a recent spat of posts about using variables in CSS.[snip] Ouch, my 4 rule css file now grows to 54,056 lines of rules re-writing the #f60 code. Wouldn't it be lovely if I just had {selectedlink} : #ffcfcf ? There's no point using a slegehammer to drive in a tack. I usually just use a regex: s/#f60/#ffcfcf/g Any decent editor should handle that in one form or the other. kind regards Terrence Wood. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
On 9/28/2005 2:33 PM Drake, Ted C. wrote: I'm not sure If I asked the question right. I'm not looking to do a search and replace. I'm hoping to set a variable in the CSS, such as This is the color of all selected links in the navigation. Then, the css would just set that variable. All of the various rules would refer to the variable instead of the actual hexdec number. CSS doesn't do variables, but here's something recently mentioned on the css-d list that does something close to what I believe you are describing, using php: http://www.shauninman.com/plete/2005/08/css-constants -- Steve Clason Web Design and Development Boulder, Colorado, USA www.topdogstrategy.com (303)818-8590 ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
RE: [WSG] css variables
Hi Ted, You're not thinking of these? http://meyerweb.com/eric/thoughts/2005/08/31/the-constants-gardener/ Cheers -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drake, Ted C. Sent: Thursday, 29 September 2005 8:33 a.m. To: 'wsg@webstandardsgroup.org' Subject: RE: [WSG] css variables Hi Terrence I'm not sure If I asked the question right. I'm not looking to do a search and replace. I'm hoping to set a variable in the CSS, such as This is the color of all selected links in the navigation. Then, the css would just set that variable. All of the various rules would refer to the variable instead of the actual hexdec number. How would the regular expression do that? Thanks Ted -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Terrence Wood Sent: Wednesday, September 28, 2005 1:07 PM To: wsg@webstandardsgroup.org Subject: Re: [WSG] css variables Drake, Ted C. said: There was a recent spat of posts about using variables in CSS.[snip] Ouch, my 4 rule css file now grows to 54,056 lines of rules re-writing the #f60 code. Wouldn't it be lovely if I just had {selectedlink} : #ffcfcf ? There's no point using a slegehammer to drive in a tack. I usually just use a regex: s/#f60/#ffcfcf/g Any decent editor should handle that in one form or the other. kind regards Terrence Wood. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
RE: [WSG] css variables
Ted, You're not thinking of these? http://meyerweb.com/eric/thoughts/2005/08/31/the-constants-gardener/ Cheers -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drake, Ted C. Sent: Thursday, 29 September 2005 8:33 a.m. To: 'wsg@webstandardsgroup.org' Subject: RE: [WSG] css variables Hi Terrence I'm not sure If I asked the question right. I'm not looking to do a search and replace. I'm hoping to set a variable in the CSS, such as This is the color of all selected links in the navigation. Then, the css would just set that variable. All of the various rules would refer to the variable instead of the actual hexdec number. How would the regular expression do that? Thanks Ted -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Terrence Wood Sent: Wednesday, September 28, 2005 1:07 PM To: wsg@webstandardsgroup.org Subject: Re: [WSG] css variables Drake, Ted C. said: There was a recent spat of posts about using variables in CSS.[snip] Ouch, my 4 rule css file now grows to 54,056 lines of rules re-writing the #f60 code. Wouldn't it be lovely if I just had {selectedlink} : #ffcfcf ? There's no point using a slegehammer to drive in a tack. I usually just use a regex: s/#f60/#ffcfcf/g Any decent editor should handle that in one form or the other. kind regards Terrence Wood. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
RE: [WSG] css variables
Hi Rebecca That's it. Thanks I see it needs php. Hm back to the drawing board. I think we need to make it work with static html. Oh well. Ted -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rebecca Cox Sent: Wednesday, September 28, 2005 2:06 PM To: wsg@webstandardsgroup.org Cc: [EMAIL PROTECTED] Subject: RE: [WSG] css variables Hi Ted, You're not thinking of these? http://meyerweb.com/eric/thoughts/2005/08/31/the-constants-gardener/ Cheers -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drake, Ted C. Sent: Thursday, 29 September 2005 8:33 a.m. To: 'wsg@webstandardsgroup.org' Subject: RE: [WSG] css variables Hi Terrence I'm not sure If I asked the question right. I'm not looking to do a search and replace. I'm hoping to set a variable in the CSS, such as This is the color of all selected links in the navigation. Then, the css would just set that variable. All of the various rules would refer to the variable instead of the actual hexdec number. How would the regular expression do that? Thanks Ted -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Terrence Wood Sent: Wednesday, September 28, 2005 1:07 PM To: wsg@webstandardsgroup.org Subject: Re: [WSG] css variables Drake, Ted C. said: There was a recent spat of posts about using variables in CSS.[snip] Ouch, my 4 rule css file now grows to 54,056 lines of rules re-writing the #f60 code. Wouldn't it be lovely if I just had {selectedlink} : #ffcfcf ? There's no point using a slegehammer to drive in a tack. I usually just use a regex: s/#f60/#ffcfcf/g Any decent editor should handle that in one form or the other. kind regards Terrence Wood. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
RE: [WSG] css variables
yeah, I thought you meant you were using 56K lines of code to replace 4 lines of CSS... sounded like overkill to me when a one line regex can do the same thing. Constants and variables are not going to part of CSS any time soon, so you will need some kind of server side solution - a few are mentioned in this thread already. AFAIK they all use seom form of regex to do the replacement, so s/selectedLink/#f60/g still works for me =) kind regards Terrence Wood. Drake, Ted C. said: Hi Terrence I'm not sure If I asked the question right. I'm not looking to do a search and replace. I'm hoping to set a variable in the CSS, such as This is the color of all selected links in the navigation. Then, the css would just set that variable. All of the various rules would refer to the variable instead of the actual hexdec number. How would the regular expression do that? Thanks Ted ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
Terrence Wood wrote: Constants and variables are not going to part of CSS any time soon, so you will need some kind of server side solution ... AFAIK they all use seom form of regex to do the replacement Well, no -- I frequently use variables in style sheets built in JSP, especially early on in development. And there it's simple Expression Language (EL) variable substitution, so something like this: a:hover, a:focus { color: ${contrastColor}; } can be evaluated per site, per session, or even per request, making it really easy to test, tune, and/or customize... FWIW! -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
Hassan Schroeder wrote: Terrence Wood wrote: Constants and variables are not going to part of CSS any time soon, so you will need some kind of server side solution ... AFAIK they all use seom form of regex to do the replacement Well, no -- I frequently use variables in style sheets built in JSP, especially early on in development. And there it's simple Expression Language (EL) variable substitution, so something like this: a:hover, a:focus { color: ${contrastColor}; } can be evaluated per site, per session, or even per request, making it really easy to test, tune, and/or customize... And as a side note, with MSIE, it is possible to give an ASP extension to the styles sheet to use scripting logic within that file. Thierry | www.TJKDesign.com ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
G'day Thierry Koblentz wrote: And as a side note, with MSIE, it is possible to give an ASP extension to the styles sheet to use scripting logic within that file. ASP, PHP or whatever server side language you use, as long as you set the appropriate content type on (in) the file (be it css.asp, css.php or whatever) it should work in more browsers than just MSIE. I just ran a test and it worked fine in Opera 8, Firefox, MSIE6 and MSIE5 PC. If it's served as text/css and the output is valid css, it shouldn't matter what the extension is. Regards -- Bert Doorn, Better Web Design http://www.betterwebdesign.com.au/ Fast-loading, user-friendly websites ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] css variables
Bert Doorn wrote: ASP, PHP or whatever server side language you use, as long as you set the appropriate content type on (in) the file (be it css.asp, css.php or whatever) it should work in more browsers than just MSIE. I just ran a test and it worked fine in Opera 8, Firefox, MSIE6 and MSIE5 PC. If it's served as text/css and the output is valid css, it shouldn't matter what the extension is. If I said MSIE it's because one does *not* need to change the MIME type ;) Thierry | www.TJKDesign.com ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **