h4md1 / jsqueeze-bundle
This bundle allows you to use jsqueeze in your twig template.
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- patchwork/jsqueeze: ~2.0
- symfony/twig-bundle: ~2.5
This package is not auto-updated.
Last update: 2025-03-05 08:33:18 UTC
README
This bundle allows you to use jsqueeze in your twig template.
Installation
Step 1: Install H4md1JsqueezeBundle using Composer
Add JsqueezeBundle in your composer.json
:
{
"require": {
"h4md1/jsqueeze-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update h4md1/jsqueeze-bundle
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new H4md1\JsqueezeBundle\H4md1JsqueezeBundle(),
// ...
);
}
Usage
{% block content %}
<h1>Hello {{ name }}!</h1>
<script>
{%- jsqueeze -%}
(function(str)
{
var newstr;
if('' !== str){
newstr = str+'#'+str;
}
else{
newstr = 'empty';
}
})('twice');
{%- endjsqueeze -%}
</script>
{% endblock %}
the code bellow will output
<h1>Hello {{ name }}!</h1>
<script>(function(e){var i;if(''!==e){i=e+'#'+e}else{i='empty'}})('twice');</script>
Known limitations and bugs
A lot for sure
License
This bundle is licensed under the MIT license.