https://github.com/eschmar/css-inliner-bundle
Simple twig css inliner for PHP Symfony
https://github.com/eschmar/css-inliner-bundle
csstoinlinestyles inline-css php symfony symfony-bundle twig
Last synced: 7 months ago
JSON representation
Simple twig css inliner for PHP Symfony
- Host: GitHub
- URL: https://github.com/eschmar/css-inliner-bundle
- Owner: eschmar
- License: mit
- Created: 2014-08-29T14:10:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-03-20T14:33:37.000Z (almost 6 years ago)
- Last Synced: 2025-07-24T16:33:48.803Z (7 months ago)
- Topics: csstoinlinestyles, inline-css, php, symfony, symfony-bundle, twig
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CssInlinerBundle
Simple twig css inliner for Symfony using [CssToInlineStyles](https://github.com/tijsverkoyen/CssToInlineStyles).
# Installation
Composer (Packagist):
```sh
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):
```php
new Eschmar\CssInlinerBundle\EschmarCssInlinerBundle(),
```
# Usage
This bundle introduces a new tag to twig:
```html
{% cssinline %}
p {
padding: 8px 15px;
color: #8E2800;
background-color: #FFB03B;
}
Bananaaa!
{% endcssinline %}
```
Which inlines all ```` tags and strips them out afterwards. The result:
```html
<p style="background-color: #FFB03B; color: #8E2800; padding: 8px 15px;">Bananaaa!</p>
```
Nothing more, nothing less. Uses the amazing [CssToInlineStyles](https://github.com/tijsverkoyen/CssToInlineStyles).
# License
MIT License. Please check [CssToInlineStyles](https://github.com/tijsverkoyen/CssToInlineStyles) for its licensing.