Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
getting Twig/Parser/Assetic work together
  • 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.
  • No, poorly not...
    Did you?
  • 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.
  • Did you ever find a solution for this? I am looking for the same answer.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion