De: Nicolas Krebs <nicolas1.krebs2@netcourrier.com>
A: spip-dev@rezo.net
Date: Sat, 29 Mar 2008 13:55:42 +0100
Sujet: [spip-dev] variables CSS au W3CDaniel Glazman (1), actuellement co-président (2) du groupe de travail
consacré au CSS (3) au sein du W3C (4), demande des témoignages
d'utilisations possibles de variables CSS, dans un article du 2008-03-29.« a mechanism to define a variable and be able later on to use that
variable as the value of a property [...]
we'll need feedback from the web authors community based on use cases » (5)1 : http://www.glazman.org/
2 : voir http://www.glazman.org/weblog/dotclear/?post/2008/03/06/CSS-Working-Group
3 : Cascading Style Sheets
4 : http://www.w3.org/
5 : http://www.glazman.org/weblog/dotclear/?post/2008/03/29/CSS-variable-constants-%3A- ,
voir aussi http://www.glazman.org/weblog/dotclear/?post/2004/12/14/746-calling-for-a-new-css-revolutionCette information peut intéresser et trouver des réponses au sein des
bidouilleurs de SPIP.
Comme promis, voici la suite, mon suivi de ce dossier.
Daniel Glazman a ensuite publié
Daniel Glazman, « Proposal for CSS Variables », Glazblog, 2008-04-08,
http://www.glazman.org/weblog/dotclear/index.php?post/2008/04/08/CSS-Variables
http://www.glazman.org/weblog/dotclear/?post/2008/04/08/CSS-Variables
qui annonce la proposition de
Daniel Glazman (Disruptive Innovations), David Hyatt (Apple),
« CSS Variables », 2008-04-08,
http://disruptive-innovations.com/zoo/cssvariables/cssvariables-20080408.html
http://disruptive-innovations.com/zoo/cssvariables/
Commentaire en français d'un employé de Daniel Glazman :
Laurent Jouanneau, « Variables en CSS », jyblog, 2008-04-09,
Laurent Jouanneau http://ljouanneau.com/blog/2008/04/09/777 .
Extrait du brouillon de spécification actuel
CSS Variables que je déconseille fortement de prendre pour prévision de la syntaxe
définitive, mais qui donne une idée du principe.
«
@variables {
CorporateLogoBGColor: #fe8d12;
}
div.logoContainer {
background-color: var(CorporateLogoBGColor);
}
»
Un règle défini une variable, et une propriété (ici var, mais value a été
proposé dans
Re: [CSSWG] action 38, CSS Variables from fantasai on 2008-04-08 (www-style@w3.org from April 2008) ),
permet ensuite de l'utiliser.
Avec cette fonction, le fichier
http://trac.rezo.net/trac/spip/browser/spip/dist/style_prive.html
(qui fait actuellement 46 ko
http://trac.rezo.net/trac/spip/browser/spip/dist/style_prive.html?rev=11449 )
pourrait être divisé en deux partie, la première devenant
style_prive-debut.html avec
-#SET{claire,##ENV{couleur_claire,edf3fe}}
-#SET{foncee,##ENV{couleur_foncee,3874b0}}
-#SET{left,#ENV{ltr}|choixsiegal{left,left,right}}
-#SET{right,#ENV{ltr}|choixsiegal{left,right,left}}
+@variables { claire: #ENV{couleur_claire,edf3fe};}
+@variables { foncee: #ENV{ltr}|choixsiegal{left,left,right};}
+@variables { left: #ENV{ltr}|choixsiegal{left,left,right};}
+@variables { right: #ENV{ltr}|choixsiegal{left,right,left};}
+@import url("#URL_PAGE{style_prive}");
et la deuxième partie restant style_prive.html
avec des remplacements de « #GET{claire} » par « var(claire) ».