.. index:: gettingstarted
.. _gettingstarted-chapter:
Getting started
===============
Suppose you have a page like this::
And, let's assume that this is available as
``http://localhost/page.html``.
Now, let's use ``mincss`` as follows::
>>> from mincss.processor import Processor
>>> p = Processor()
>>> p.process('http://localhost/page.html')
>>> inline = p.inlines[0]
>>> inline.before
'\n .foo, input:hover { color: black; }\n .bar { color: blue; }\n '
>>> inline.after
'\n .foo { color: black; }\n '
As you can see, it automatically discovered that the ``input:hover``
and the ``.bar`` selectors are not used in the HTML DOM tree.
If you have ``phantomjs`` installed and can do things like
``$ phantomjs --help`` on your command line you can run mincss like
this::
>>> from mincss.processor import Processor
>>> p = Processor(phantomjs=True)
>>> p.process('http://localhost/page-with-javascript.html')