Skip to content

eschmar/css-inliner-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CssInlinerBundle

Simple twig css inliner for Symfony using CssToInlineStyles.

Installation

Composer (Packagist):

composer require eschmar/css-inliner-bundle ^2.0.0 # Symfony ^5.0

# or

composer require eschmar/css-inliner-bundle ^1.0.0 # Symfony ^4.1

# or

composer require eschmar/css-inliner-bundle ^0.2.0 # Symfony ^3.4

app/Appkernel.php (Symfony <4):

new Eschmar\CssInlinerBundle\EschmarCssInlinerBundle(),

Usage

This bundle introduces a new tag to twig:

{% cssinline %}
    <style>
        p {
            padding: 8px 15px;
            color: #8E2800;
            background-color: #FFB03B;
        }
    </style>
    <p>Bananaaa!</p>
{% endcssinline %}

Which inlines all <style> tags and strips them out afterwards. The result:

<p style="background-color: #FFB03B; color: #8E2800; padding: 8px 15px;">Bananaaa!</p>

Nothing more, nothing less. Uses the amazing CssToInlineStyles.

License

MIT License. Please check CssToInlineStyles for its licensing.

About

Simple twig css inliner for PHP Symfony

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages