Hello,
I'm trying to get Twig with Parser and Assetics to work. If i try to use
{% javascripts 'vendor/mootools/*' output='javascript/script.js' debug=true %}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endjavascripts %}
in my twig-view i get the following error:
Assetic\Extension\Twig\AsseticExtension::__construct() must be an instance of Assetic\Factory\AssetFactory, none given
This is due i tried to load the twig-extension via the parser config and this doesn't parse params to the class
foreach (\Config::get('parser.View_Twig.extensions') as $ext)
{
static::$_parser->addExtension(new $ext());
}
In the documentation it's like this:
$twig->addExtension(new AsseticExtension($factory, $debug));
How do i get it to work the best way?
thanks for your help and sorry for my bad english.
Since twig cant parse php the key is to use the asset helper in the controller and attach it to $data or whatever asset you are using, then pass the $data to the parser for rendering.