All Projects → twigphp → cssinliner-extension

twigphp / cssinliner-extension

Licence: MIT license
[DEPRECATED] CSS inliner support for Twig

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to cssinliner-extension

Fmbbcodebundle
🔠 BBCode bundle for Symfony projects
Stars: ✭ 56 (+86.67%)
Mutual labels:  twig, twig-extension
Html Compress Twig
Twig extension for compressing HTML and inline CSS/JS using WyriHaximus/HtmlCompress
Stars: ✭ 72 (+140%)
Mutual labels:  twig, twig-extension
Inky Extension
[DEPRECATED] Inky email template engine support for Twig
Stars: ✭ 57 (+90%)
Mutual labels:  twig, twig-extension
breadcrumb-bundle
Symfony bundle for easy breadcrumbs management
Stars: ✭ 26 (-13.33%)
Mutual labels:  twig, twig-extension
Markdown Extension
[DEPRECATED] Markdown support for Twig
Stars: ✭ 105 (+250%)
Mutual labels:  twig, twig-extension
Twig Extra Bundle
The Twig bundle for official extra extensions
Stars: ✭ 389 (+1196.67%)
Mutual labels:  twig, twig-extension
Twig Cache Extension
Stars: ✭ 67 (+123.33%)
Mutual labels:  twig, twig-extension
cache-extra
Template fragment cache support for Twig
Stars: ✭ 24 (-20%)
Mutual labels:  twig, twig-extension
Twig Deferred Extension
An extension for Twig that allows to defer block rendering.
Stars: ✭ 97 (+223.33%)
Mutual labels:  twig, twig-extension
Cssinliner Extra
CSS Inliner support for Twig
Stars: ✭ 93 (+210%)
Mutual labels:  twig, twig-extension
time-ago-bundle
Provides a simple twig filter for expressing time difference in words.
Stars: ✭ 13 (-56.67%)
Mutual labels:  twig, twig-extension
Reactrenderer
Client and Server-side React rendering from PHP
Stars: ✭ 201 (+570%)
Mutual labels:  twig, twig-extension
oc-twigextensions-plugin
Twig extensions plugin for OctoberCMS
Stars: ✭ 17 (-43.33%)
Mutual labels:  twig, twig-extension
Html Extra
HTML extension for Twig
Stars: ✭ 24 (-20%)
Mutual labels:  twig, twig-extension
joomla-twig
Twig 2.0 & Twig extensions integration for Joomla! https://phproberto.github.io/joomla-twig/
Stars: ✭ 25 (-16.67%)
Mutual labels:  twig, twig-extension
Awesome Twig
A curated list of amazingly awesome Twig extensions, snippets and tutorials
Stars: ✭ 63 (+110%)
Mutual labels:  twig, twig-extension
PhpStorm-Live-Templates-Craft-CMS
PhpStorm Live Templates for Craft CMS
Stars: ✭ 34 (+13.33%)
Mutual labels:  twig, twig-extension
twig-translation
A Twig Translation Extension
Stars: ✭ 15 (-50%)
Mutual labels:  twig, twig-extension
String Extra
Unicode/String support for Twig
Stars: ✭ 92 (+206.67%)
Mutual labels:  twig, twig-extension
Twig Extensions
Twig extensions
Stars: ✭ 1,469 (+4796.67%)
Mutual labels:  twig, twig-extension

Twig CSS Inliner Extension

WARNINIG: This package is deprecate; migrate to twig/cssinliner-extra instead.

This package provides a CSS inliner filter (inline_css) for Twig and a Symfony bundle.

If you are not using Symfony, register the extension on Twig's Environment manually:

use Twig\CssInliner\CssInlinerExtension;
use Twig\Environment;

$twig = new Environment(...);
$twig->addExtension(new CssInlinerExtension());

Use the inline_css filter from a Twig template:

{% filter inline_css %}
    <html>
        <head>
            <style>
                p { color: red; }
            </style>
        </head>
        <body>
            <p>Hello CSS!</p>
        </body>
    </html>
{% endfilter %}

You can also add some stylesheets by passing them as arguments to the filter:

{% filter inline_css(source("some_styles.css"), source("another.css")) %}
    <html>
        <body>
            <p>Hello CSS!</p>
        </body>
    </html>
{% endfilter %}

Styles loaded via the filter override the styles defined in the <style> tag of the HTML document.

You can also use the filter on an included file:

{{ include('some_template.html.twig')|inline_css }}

{{ include('some_template.html.twig')|inline_css(source("some_styles.css")) }}

Note that the CSS inliner works on an entire HTML document, not a fragment.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].