Skip to main content

Inlines external CSS into HTML elements.

Project description

inlinestyler
============

Inlinestyler is the styling code behind Dave Cranwell's *Inline Style* app - https://github.com/davecranwell/inline-styler - packaged into a library for ease of use elsewhere.

He writes:

It's a service which, when given a block of HTML including CSS,
will parse the CSS and convert it to inline "style" attributes
on each elements matched by the CSS rules found.

The benefit of this is primarily in developing HTML emails.
The most common email clients have patchy support for <style>
or <link> elements, but do on the whole support a varied set
of CSS properties. Its therefore necessary to instead define
styles in "style" attributes on each of the elements
themselves, which is tedious for anything but the simplest
of emails and introduces significant code maintenance problems.
The Inline Styler frees up the developer to write CSS in less
tedious/more maintainable ways: using proper selectors and rules,
grouped in either a stylesheet or a <style> block. The Inline
Styler converts these rules into the inline "style" attributes
for you.

Additionally, among the email clients who do support CSS, support
for individual CSS properties is variable. The Inline Styler will
analyse your CSS and estimate a compatibility rating across all
the email clients as a whole, alerting you to any particular
properties likely to reduce compatibility.

You can see a working example of this service at
http://inlinestyler.torchboxapps.com.

To use this app, CSS to be "inlined" must be presented in the HTML either
* linked absolutely e.g <link rel="stylesheet" href="http://mysite.com/styles.css" /> or
* provided in a <style> block in the <head> of the HTML, without @imports

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

inlinestyler-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

File details

Details for the file inlinestyler-0.1.1.tar.gz.

File metadata

  • Download URL: inlinestyler-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for inlinestyler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8d8538dc9f95a045a898435b560c9370dfad2006540fb035b629db4f794b9124
MD5 04e5dd5db9d2789ec8e2e2276041e00b
BLAKE2b-256 197005b995ce21005a99b88980ab169e5810f0cbef630b88103ea5a20abd00b0

See more details on using hashes here.

Supported by

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