-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #115 Reset assets on FINISH_REQUEST. (Warxcell)
This PR was merged into the main branch. Discussion ---------- Reset assets on FINISH_REQUEST. Fixes #90, #94 Commits ------- 029b01b Reset caches on FINISH_REQUEST. Fixes #90, #94
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\WebpackEncoreBundle\EventListener; | ||
|
||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Component\HttpKernel\KernelEvents; | ||
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollection; | ||
|
||
class ResetAssetsEventListener implements EventSubscriberInterface | ||
{ | ||
private $entrypointLookupCollection; | ||
private $buildNames; | ||
|
||
public function __construct(EntrypointLookupCollection $entrypointLookupCollection, array $buildNames) | ||
{ | ||
$this->entrypointLookupCollection = $entrypointLookupCollection; | ||
$this->buildNames = $buildNames; | ||
} | ||
|
||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
KernelEvents::FINISH_REQUEST => 'resetAssets', | ||
]; | ||
} | ||
|
||
public function resetAssets() | ||
{ | ||
foreach ($this->buildNames as $name) { | ||
$this->entrypointLookupCollection->getEntrypointLookup($name)->reset(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters