mincss now support PhantomJS

02 February 2013   3 comments   Python

Mind That Age!

This blog post is 4 years old! Most likely, its content is outdated. Especially if it's technical.

Powered by Fusion×

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 () {

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.


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:

dunno if thats news to you.
Peter Bengtsson
Looks promising, but...
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?
Thank you for posting a comment

Your email will never ever be published

Related posts

mincss in action - sample report from the wild 22 January 2013
mincss version 0.8 is much much faster 27 February 2013
How to no-mincss links with django-pipeline 03 February 2016
What's the average number of domains a website depends on? 24 February 2014
This site is now 100% inline CSS and no bytes are wasted 05 March 2013
mincss version 0.8 is much much faster 27 February 2013
mincss in action - sample report from the wild 22 January 2013
mincss "Clears the junk out of your CSS" 21 January 2013
window.onload from before 07 June 2005