How do you register twig extensions in a plugin. I want to add this package to my app : https://github.com/nochso/html-compress-twig
The package has filters, functions and tags.
I have been trying for hours without success. Here's an attempt
use nochso\HtmlCompressTwig\Extension;
public function registerMarkupTags()
{
return [
'functions' => [
'htmlcompress' => [(new Extension()), 'getFunctions'],
]
];
}
Error : The "HtmlCompressTwig" extension is not enabled.
Or
return [
'functions' => [
(new Extension())->getFunctions()
]
];
Error : An exception has been thrown during the compilation of a template ("The markup function for 0 is not callable.").
The getFunctions() in Extensions.php is
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('htmlcompress', $this->callable, $this->options),
);
}
Anyone ?