Skip to main content

Fast lxml-based CSS stylesheet inliner.

Project description

Fast lxml-based CSS stylesheet inliner.

https://travis-ci.org/disqus/toronado.svg?branch=master

Tested against Python 2.7, 3.3, 3.4, and 3.5.

Installation

This package is hosted on PyPI and can be installed using pip or easy_install:

pip install toronado

Usage

>>> import toronado
>>> document = """<html>
... <head>
...     <style type="text/css">
...         h1 { color: red; }
...     </style>
... </head>
... <body><h1>Hello, world.</h1></body>
... </html>"""
>>> print(toronado.from_string(document))
<html><head></head><body><h1 style="color: red">Hello, world.</h1></body></html>

Command Line Usage

To inline a file directly from the command line, you can use the following:

python -m toronado input.html

The inlined HTML will be printed to your shell’s stdout stream, and can also be redirected to a file:

python -m toronado input.html > output.html

Known Issues

  • Expansion of some shorthand properties is not fully implemented (margin and padding are supported, however.) Mixing shorthand properties and specific properties such as font and font-size may lead to unexpected inheritance results. (See GH-19 for details.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toronado-0.0.8.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file toronado-0.0.8.tar.gz.

File metadata

  • Download URL: toronado-0.0.8.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for toronado-0.0.8.tar.gz
Algorithm Hash digest
SHA256 32973e86908eab72676830aaa6e9da63331c0a958d47fc54d3f5676b1203a66c
MD5 0c2035c11a66d80089ef6fd8059989ed
BLAKE2b-256 3ba386095d400e8150421faeefa3a95474040e90ea94382d476d273a7f9f78b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page