summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2017-06-02 01:23:14 +0200
committerArnold Daniels <arnold@jasny.net>2017-06-02 01:25:20 +0200
commit0ed94f36abb86990b7f4bfaef0af79d68e6762c3 (patch)
treefe8cde87379d3725603ee654058d75977f0ed196 /src
parent5d67729046776d9178326f9a28d2c5d593e3cec6 (diff)
downloadview-0ed94f36abb86990b7f4bfaef0af79d68e6762c3.zip
view-0ed94f36abb86990b7f4bfaef0af79d68e6762c3.tar.gz
view-0ed94f36abb86990b7f4bfaef0af79d68e6762c3.tar.bz2
Use `TwigCachingFormulaLoader` if available.
Suggest assetic and assetic-extensions in composer
Diffstat (limited to 'src')
-rw-r--r--src/View/Plugin/TwigAssetic.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/View/Plugin/TwigAssetic.php b/src/View/Plugin/TwigAssetic.php
index 3e04cf1..d1aa62a 100644
--- a/src/View/Plugin/TwigAssetic.php
+++ b/src/View/Plugin/TwigAssetic.php
@@ -11,6 +11,7 @@ use Assetic\Extension\Twig\TwigFormulaLoader;
use Assetic\Extension\Twig\TwigResource;
use Assetic\Factory\AssetFactory;
use Assetic\Factory\LazyAssetManager;
+use Jasny\Assetic\TwigCachingFormulaLoader;
/**
* Assetic support for Twig
@@ -73,17 +74,20 @@ class TwigAssetic implements PluginInterface
*/
protected function createFormulaLoader($twig)
{
- return new TwigFormulaLoader($twig);
+ $class = class_exists('Jasny\Assetic\TwigCachingFormulaLoader')
+ ? TwigCachingFormulaLoader::class
+ : TwigFormulaLoader::class;
+
+ return new $class($twig);
}
/**
* Create an assetic asset manager.
* @codeCoverageIgnore
*
- * @param TwigFormulaLoader $loader
* @return LazyAssetManager
*/
- protected function createAssetManager(TwigFormulaLoader $loader)
+ protected function createAssetManager()
{
return new LazyAssetManager($this->factory);
}