-
Notifications
You must be signed in to change notification settings - Fork 68
Devfront: internalisation de la librairie semantic-ui #2179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,3 +54,4 @@ js_dist | |
| /assets/vendor/ | ||
| drivers | ||
| chromedriver.log | ||
| /htdocs/dist | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surcharge du répertoire final des assets après compilation (cf. https://symfony.com/doc/current/frontend/asset_mapper.html#serving-assets-in-dev-vs-prod). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace AppBundle\AssetMapper; | ||
|
|
||
| use Symfony\Component\AssetMapper\Compressor\CompressorInterface; | ||
| use Symfony\Component\AssetMapper\Path\PublicAssetsFilesystemInterface; | ||
| use Symfony\Component\DependencyInjection\Attribute\Autowire; | ||
| use Symfony\Component\Filesystem\Filesystem; | ||
|
|
||
| /** | ||
| * cf. https://symfony.com/doc/current/frontend/asset_mapper.html#serving-assets-in-dev-vs-prod | ||
| */ | ||
| class PostCompilationCopyHandler implements PublicAssetsFilesystemInterface | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C'est à cause du Si un jour on migre vers un
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oui c'est en partie à cause de ça mais surtout parce que la commande J'aurai pu surcharger la valeur de |
||
| { | ||
| private Filesystem $filesystem; | ||
|
|
||
| /** | ||
| * @param string[] $extensionsToCompress | ||
| */ | ||
| public function __construct( | ||
| #[Autowire('%kernel.project_dir%/../htdocs')] | ||
| private readonly string $publicDir, | ||
| private readonly ?CompressorInterface $compressor = null, | ||
| private readonly array $extensionsToCompress = [], | ||
| ) { | ||
| $this->filesystem = new Filesystem(); | ||
| } | ||
|
|
||
| public function write(string $path, string $contents): void | ||
| { | ||
| $targetPath = $this->publicDir . '/' . ltrim($path, '/'); | ||
|
|
||
| $this->filesystem->dumpFile($targetPath, $contents); | ||
| $this->compress($targetPath); | ||
| } | ||
|
|
||
| public function copy(string $originPath, string $path): void | ||
| { | ||
| $targetPath = $this->publicDir . '/' . ltrim($path, '/'); | ||
|
|
||
| $this->filesystem->copy($originPath, $targetPath, true); | ||
| $this->compress($targetPath); | ||
| } | ||
|
|
||
| public function getDestinationPath(): string | ||
| { | ||
| return $this->publicDir; | ||
| } | ||
|
|
||
| private function compress(string $targetPath): void | ||
| { | ||
| foreach ($this->extensionsToCompress as $ext) { | ||
| if (!str_ends_with($targetPath, ".$ext")) { | ||
| continue; | ||
| } | ||
|
|
||
| $this->compressor?->compress($targetPath); | ||
|
|
||
| return; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,6 @@ | |
|
|
||
| {% block footer '' %} | ||
| {% block javascripts '' %} | ||
| {# {% block importmap %}{{ importmap('app') }}{% endblock %}#} | ||
| {% block importmap %}{{ importmap('app') }}{% endblock %} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L'importmap il faut la mettre dans la balise Mais bon ce template c'est pas pour l'admin donc faudra juste penser à le bouger quand on activera l'asset mapper pour le front. |
||
| </body> | ||
| </html> | ||
Uh oh!
There was an error while loading. Please reload this page.