[whatwg] web preprocessing

I would like to propose and request a feature for the web standards. The
best way to describe it: a html preprocessor.
In a similar vein to the C preprocessor and the like, the syntax would
allow constants to be defined to be accessible across both html, css and js.
Scenario's where this is useful occur quite frequently, if not on every
webpage. For instance, when lay-out contstants need to be duplicated in css
and js, or when user messages need to be duplicated in html and js.
In many cases, code clarity and brevity would be helped as well as a
reduction in bandwidth, accordingly.

Implementations could make use of the meta elements or a new syntactic
layer could be added.


example:
HTML head: <meta name="boxWidth" content="640"/>
CSS: #box{width:meta(boxWidth)}
 (or #box{width:meta('boxWidth')})
JS:  box.style.width=document.meta(
'boxWidth');

another example:
HTML head: <meta name="labelPlay" content="Let me hear you sing it!"/>
HTML body:  <button><meta name="labelPlay"></button>
JS:  box.innerHTML=document.meta('labelPlay');


Have a good one,
Marnix T'Jaeckx
http://aelgoa.50webs.com/#marnix

Received on Tuesday, 27 November 2012 07:41:35 UTC