May 2015 - Broken Links Archive

The drawbacks of post-processing

In the last few days I’ve been inves­ti­gat­ing CSS post-pro­cess­ing, the idea behind which – writ­ing stylesheets using par­tial­ly imple­ment­ed or emerg­ing stan­dards, which are then tran­spiled to make files which work in cur­rent browsers — is more pleas­ing to me than the abstrac­tions of pre-proces­sors like Sass. I’ve been exper­i­ment­ing with PostC­SS (or rather, css­next, which is to PostC­SS as (broad­ly) Bour­bon is to Sass); how­ev­er, there are a cou­ple of prob­lems with post-pro­cess­ing, at least in the way that PostC­SS approach­es it, which makes me ques­tion its utitility.

NB I must state clear­ly that these obser­va­tions are based on a very shal­low under­stand­ing from my ini­tial inves­ti­ga­tions of how PostC­SS works, and per­haps they would be clar­i­fied and resolved if I tried to use it on a full project. Update: See also the com­ments below this arti­cle, which clear up some of my misconceptions.

The first is that post-pro­cess­ing uses syn­tax from pro­posed stan­dards which have yet to be rat­i­fied. For exam­ple, the vari­ables syn­tax is based on Cus­tom Prop­er­ties which, athough imple­ment­ed in Fire­fox, are yet to have any firm com­mit­ment from oth­er brows­er ven­dors; the syn­tax could still be changed, or indeed dropped entire­ly. That would mean PostC­SS would have to either retain an out­dat­ed syn­tax for back­wards com­pat­i­bil­i­ty, or change it com­plete­ly to match future deci­sions, mak­ing main­tain­abil­i­ty of old projects hard­er for developers.

The sec­ond prob­lem is that the fea­tures of Sass which are most use­ful (and wide­ly used) are those which great­ly extend the core CSS syn­tax – notably, nest­ing and mix­ins. While there are PostC­SS plu­g­ins that add exten­sions to match pre-pro­cess­ing fea­tures, using them means that your source stylesheet is no longer ‘prop­er’ CSS — which is the main attrac­tion of a post-proces­sor to me. If your source stylesheet is large­ly invalid, you might as well use a pre-processor.

Per­haps, as Lyza Dan­ger Gard­ner con­clud­ed, using post-proces­sors means giv­ing up cer­tain features:

Tak­ing a path paved with lean, mod­u­lar post-pro­cess­ing plu­g­ins involves sac­ri­fices. No more nest­ing. Instead of an end­less hori­zon of mix­in pos­si­bil­i­ties, you may be bound to CSS spec real­i­ties, like calc or CSS variables.

I still like the idea of post-pro­cess­ing, but per­haps I need a longer peri­od of accli­ma­ti­sa­tion before it ful­ly makes sense to me.

 


Aside

I’ve updat­ed my Speak­ing page to include more con­fer­ences, more videos, and a lit­tle on my speak­ing require­ments and pref­er­ences. I’m plan­ning to cut down on the num­ber of talks I give in 2014 (twelve is too many), but am always open to inter­est­ing offers and oppor­tu­ni­ties, so please get in touch if you’re organ­is­ing an event.

[#] 1 Comment . More Asides.