Download the PHP package phpmob/twig-modify-bundle without Composer
On this page you can find all versions of the php package phpmob/twig-modify-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpmob/twig-modify-bundle
More information about phpmob/twig-modify-bundle
Files in phpmob/twig-modify-bundle
Package twig-modify-bundle
Short Description Twig Minifier just you like.
License MIT
Homepage http://github.com/phpmob/twig-modify-bundle
Informations about the package twig-modify-bundle
TwigModifyBundle
TwigModify is a twig tag that can modifies everythink you want eg. cssmin, jsmin and more.
Installing
Installing via composer is
recommended.
Enabling
And then enable bundle in AppKernel.php
Usage
In order to modify your twig is simple just wrap {% modify modifier %}...{% modify %} like this:
That was it!
Build-in Modifiers
There are supported modifiers in this bundle.
JSMin
A wrapped modifier for \JShrink\Minifier::minify, Thanks tedivm/jshrink
CSSMin
A wrapped modifier for \tubalmartin\CssMin\Minifier::minify, Thanks tubalmartin/cssmin
HtmlPurify
A wrapped modifier for \HTMLPurifier::purify, Thanks ezyang/htmlpurifier
AntiXss
A wrapped modifier for \voku\helper\AntiXSS, Thanks voku/anti-xss
Cache
TwigModifyBundle use local cache folder by default, however you can use any cache that implemented \Symfony\Component\Cache\Adapter\AdapterInterface interface and then change the confiuration for your cache service:
You can also use symfony framework-bundle cache adapter.
Don't fogot enable DoctrineCacheBundle in your AppKernel.php - See https://symfony.com/doc/current/bundles/DoctrineCacheBundle/index.html
Your own modifiers
You can add/override modifiers by easy configuration:
After that you already to use your new modifier.
Configuration
Configuration reference:
Thanks
- https://github.com/nibsirahsieu/SalvaJshrinkBundle to nice demonstration.
- https://github.com/Exercise/HTMLPurifierBundle to nice demonstration.
- https://github.com/ezyang/htmlpurifier
- https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
- https://github.com/tedious/JShrink
- https://github.com/voku/anti-xss
License
MIT
All versions of twig-modify-bundle with dependencies
ezyang/htmlpurifier Version ^4.9
tedivm/jshrink Version ^1.2
tubalmartin/cssmin Version ^4.1
voku/anti-xss Version ^4.0
symfony/cache Version ^3.1|~4.0
symfony/config Version ^3.1|~4.0
symfony/dependency-injection Version ^3.1|~4.0
symfony/http-kernel Version ^3.1|~4.0