Remember mincss from a couple of days ago? Now it supports downloading the HTML, to analyze, using PhantomJS. That's pretty exciting because PhantomJS actually supports Javascript. It's a headless (a web browser without a graphical user interface) Webkit engine. What mincss does is that invokes a simple script like this:


var page = require('webpage').create();
page.open(phantom.args[0], function () {
  console.log(page.content);
  phantom.exit();
});

which will allow any window.onload events to fire which might create more DOM nodes. So, like in this example it'll spit out HTML that contains a <p class="bar"> tag which you otherwise wouldn't get with Python's urllib.urlopen().

The feature was just added (version 0.6.0) and I wouldn't be surprised if there are dragons there because I haven't tried it on a lot of sites. And at the time of writing, I was not able to compile it on my Ubuntu 64bit server so I haven't put it into production yet.

Anyway, with this you can hopefully sprinkle less of those /* no mincss */ comments into you CSS.

Comments

ëRiC

He Peter! Nice to see you progressing about this! I really like the idea of having a computed view onto your CSS rather than just the eye :]

after some days of your first post read an article on this already:
http://www.csstrashman.com

dunno if thats news to you.
ëRiC

Peter Bengtsson

Looks promising, but...
http://cl.ly/MfAk

ëRiC

AAahhhh haahaaaa ... ehmm *harrump* I actually didn't test it!
But this should be embarassing for them! Your site is far from compicated, isn't it?

Your email will never ever be published.

Previous:
mincss in action - sample report from the wild January 22, 2013 Python, Web development
Next:
mincss version 0.8 is much much faster February 27, 2013 Python
Related by category:
How I run standalone Python in 2025 January 14, 2025 Python
get in JavaScript is the same as property in Python February 13, 2025 Python
How to resolve a git conflict in poetry.lock February 7, 2020 Python
Best practice with retries with requests April 19, 2017 Python
Related by keyword:
How to submit a form with Playwright August 3, 2021 JavaScript
mincss "Clears the junk out of your CSS" January 21, 2013 Python, Web development
Now using minimalcss March 12, 2018 Python, Web development, Node, JavaScript
How to no-mincss links with django-pipeline February 3, 2016 Python, Web development, Django