W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

[whatwg] web preprocessing

From: Marnix T'Jaeckx <marnix.tjaeckx@gmail.com>
Date: Tue, 27 Nov 2012 09:33:05 +0200
Message-ID: <CAKOPQodTr4Zo+Txrjowrmd3jum241=ueKk+1SUD9pLJvA+_ojQ@mail.gmail.com>
To: whatwg@lists.whatwg.org
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.

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

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
Received on Tuesday, 27 November 2012 07:41:35 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:48 UTC