css-to-inline-styles-twig-extension

CssToInlineStyles Twig Extension

5 months after

Inline Css extension to convert css to inline styles

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Based on work by Roberto Trunfio on https://github.com/robertotru/ToInlineStyleEmailBundle

Makes use of https://github.com/tijsverkoyen/CssToInlineStyles by Tijs Verkoyen

Installation

This twig extension is installed through Composer. Run the following command from the root of your project:

composer require nerds-and-company/css-to-inline-styles-twig-extension

This will add nerds-and-company/css-to-inline-styles-twig-extension as a requirement to your project's composer.json file and install the source-code into the vendor/nerds-and-company/css-to-inline-styles-twig-extension directory

Add the extension to the Twig_Environment:

use NerdsAndCompany\CssToInlineStyles\Twig\InlineCssExtension;

$twig = new Twig_Environment(...);

$twig->addExtension(new InlineCssExtension());

Usage

{% inlinecss '/absolute/path/file.css' %}
   <tag>Html to be converted</tag>
{% endinlinecss %}

Related Repositories

awesome-php

awesome-php

A curated list of amazingly awesome PHP libraries, resources and shiny things. ...

fuelphp-casset

fuelphp-casset

Better asset management library for fuelphp (with minification!) ...

ansi-to-html

ansi-to-html

An ANSI to HTML5 converter ...

webpack-bundle

webpack-bundle

Bundle to Integrate Webpack into Symfony ...

awesome-php

awesome-php

A curated list of amazingly awesome PHP libraries, resources and shiny things. ...