Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Twig extension for BundleFu.
tree: 4f967a0724

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/DotsUnited/BundleFu/Twig
tests
.gitignore
.travis.yml
CHANGELOG
LICENSE
README.markdown
composer.json
phpunit.travis.xml
phpunit.xml.dist

README.markdown

Twig extension for BundleFu

Build Status

The BundleFuTwigExtension integrates BundleFu into the Twig template engine.

Installation

BundleFuTwigExtension can be installed using the Composer tool. You can either add dotsunited/bundlefu-twig-extension to the dependencies in your composer.json, or if you want to install BundleFuTwigExtension as standalone, go to the main directory and run:

$ wget http://getcomposer.org/composer.phar 
$ php composer.phar install

You can then use the composer-generated autoloader to access the BundleFuTwigExtension classes:

<?php
require 'vendor/autoload.php';
?>

Usage

Register the BundleFuExtension to your Twig environment:

<?php
$factory = new \DotsUnited\BundleFu\Factory();
$extension = \DotsUnited\BundleFu\Twig\BundleFuExtension($factory);

$twig = new \Twig_Environment($loader);
$twig->addExtension($extension);
?>

The extension uses the factory to create bundle instances. See the BundleFu documentation about how to configure the factory.

The extension exposes a new bundle tag with the following syntax:

{% bundle name='test_bundle'
          doc_root = '/my/docroot'
          bypass=false
          render_as_xhtml=true
          css_filter='css_filter'
          js_filter='js_filter'
          css_cache_path='cache'
          js_cache_path='cache'
          css_cache_url='/cache'
          js_cache_url='/cache'
%}
<link href="/css_1.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="/js_1.js" type="text/javascript"></script>
{% endbundle %}

License

BundleFuTwigExtension is released under the New BSD License.

Something went wrong with that request. Please try again.