News for hackers. Stuff that matters.
Re:Descartes – An experimental library for writing CSS in Ja... by userbinator on Sunday February 21, 2016 @11:20AM (#11145055)
Descartes is just over 30KB when minified and just over 300 lines of code.

For comparison, there's 12KB of text on the page.

There's something about writing 30KB+ of code, plus chunk of CSS-in-JS-syntax, and then using the energy of every single visitor's machines to duplicate the work at a massive scale to generate another chunk of CSS that the browser then has to parse, after executing that JS, which you could've just generated once on the server, that feels fundamentally wrong. IMHO this flagrant disregard for resource consumption is one of the reasons why the "Modern Web(tm)" is as unpleasant as it is.

Re:Descartes – An experimental library for writing CSS in Ja... by na85 on Sunday February 21, 2016 @01:30PM (#11145730)
This is why I give thanks for noscript.

The web is so much more pleasant without.

Re:Descartes – An experimental library for writing CSS in Ja... by JoeAltmaier on Sunday February 21, 2016 @11:21AM (#11145061)
Its called 'scaling'. There are 1B personal devices and only 1 server. So anything that unloads the server is a good thing?
Re:Descartes – An experimental library for writing CSS in Ja... by userbinator on Sunday February 21, 2016 @11:43AM (#11145152)
How about just serving the CSS directly? It could even be generated from JS with a tool like this one. Now you don't even have to serve the JS that generates it.
Re:Descartes – An experimental library for writing CSS in Ja... by err4nt on Sunday February 21, 2016 @11:55AM (#11145207)
It would seem that Descartes allows you to change the values of the CSS _after_ page load, which no amount of precompiling can do!

This is what plugins like Descartes are trying to solve - how do we inform CSS of values on the page which may be different between different browsers or users, or may change on the page after it loads as users interact with it.

http://elementqueries.com/demos/variables.html

Here's an example using EQCSS of accessing JavaScript Variables from CSS - I'd ~LOVE~ to see what CSS you could prepare and send in advance that would produce the same thing.

It can't be done :)

Re:Descartes – An experimental library for writing CSS in Ja... by herbst on Monday February 22, 2016 @06:30AM (#11150080)
Thats not was CSS is supposed to do. I am happy its not possible, else even more people would exploit it.
Re:Descartes – An experimental library for writing CSS in Ja... by Tobold on Sunday February 21, 2016 @01:34PM (#11145762)
How is delivering 30kb javascript file instead of 1kb CSS file reducing load? CSS is static, just put it in a static file! Bam! Load reduced!