So I stumbled across some frameworks for doing CSS post processing such as pleeease.io and I was wondering what are some main benefits or use cases for using CSS post processing? I feel you can achieve more or less the same thing with preprocessing mixins/functions. How are they used in conjunction with preprocessing languages like SASS or LESS?
Web Development – CSS Preprocessing (SASS or LESS) vs CSS Postprocessing
cssweb-development
Related Solutions
CSS isn't trying to make things more difficult on purpose, it was designed with a far simpler goal in mind, variables and hierarchies are hardly its only shortcomings. LESS and Sass exist specifically to address these shortcomings, and until either capability is natively supported, you should stick with them.
That said, W3C's CSS Working Group is working on drafts for both CSS variables and CSS hierarchies:
There's absolutely no way to tell when either draft will be ready for implementation, or how soon major browsers will adopt them. All I can say is that the CSS Variables draft is closer to being adopted, you can already test drive CSS variables in Chrome, Safari and Firefox, but keep in mind that support in all three browsers is considered experimental and subject to change. Read Using CSS variables on MDN for more details.
There are several advantages to this approach:-
- Responsiveness, because the business logic is in the fat client you do not need to wait for a round trip over the network for every interaction.
- Sophistication - having all the control and higher level logic in the client enables rich user interfaces (e.g. this site, or gmail) which would simply not be possible if every interaction required a round trip to the server.
- Scalability, all this processing is taking place on your device, using your electricity. if you have a large number of users the saving in server side processing is significant.
There are a few downsides though.
- Lack of control over the client environment. You do not know which browser on which OS or what screen size and processing power your client will have. You application may not work on every client.
- Uneven response. Large client libraries need to be downloaded and upgraded every now and then which will be relatively slow, once downloaded the response is lightning fast, users, generally prefer a consistent response time even if it is a little slower.
- Javascript -- love it or hate it you are stuck with it as your main development language. Your code becomes public which some companies hate (perhaps they are embarrassed by their code quality?).
- Security -- your server side code is now largely just database services whose APIs are open to anyone studying your Javascript therefore you need to take extra care in securing these services.
Best Answer
The difference between postprocessing and preprocessing is non-existent, at least in the case of programming languages. Both describe a transformation from some format A (which is authored by a human) to format B (which is necessary to have, but inconvenient to write):
A few observations on those examples:
The input and output format can be the same. This is the case in code tidiers, minifiers, and other processors that somehow simplify the source. E.g. the C preprocessor expands macros and constants in the source code. This is equivalent to autoprefixer, which expands unprefixed CSS directives into their prefixed variants.
Processors can involve multiple sub-processors that each do some part of the transformation.
If pleeease calls itself a post-processor rather than a pre-processor, this is done …
To summarize: There is no technical reason to differentiate between preprocessing and postprocessing in the realm of programming languages. The term “postprocessing” is not widely used in this domain, and one should therefore substitute and prefer “preprocessing”, “compiling”, or “transformation”.