From a9e9ec56dda77532fe4ab6c6b62714c63efa4f35 Mon Sep 17 00:00:00 2001 From: vgreb Date: Wed, 4 Feb 2026 23:12:42 +0100 Subject: [PATCH] DevFront - ajout de symfony/asset-mapper --- .gitignore | 2 +- app/config/packages/asset_mapper.yaml | 12 + assets/app.js | 2 + assets/styles/app.css | 7 + composer.json | 8 +- composer.lock | 301 ++++++++++++++------ htdocs/templates/site/scss/base/layout.scss | 8 - importmap.php | 19 ++ templates/base.html.twig | 1 + 9 files changed, 265 insertions(+), 95 deletions(-) create mode 100644 app/config/packages/asset_mapper.yaml create mode 100644 assets/app.js create mode 100644 assets/styles/app.css create mode 100644 importmap.php diff --git a/.gitignore b/.gitignore index a356abd5c..159e286b9 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,4 @@ js_dist /compose.override.yml /composer.phar /data - +/assets/vendor/ diff --git a/app/config/packages/asset_mapper.yaml b/app/config/packages/asset_mapper.yaml new file mode 100644 index 000000000..9f34e3da2 --- /dev/null +++ b/app/config/packages/asset_mapper.yaml @@ -0,0 +1,12 @@ +framework: + asset_mapper: + # The paths to make available to the asset mapper. + paths: + - '%kernel.project_dir%/../assets/' + importmap_path: '%kernel.project_dir%/../importmap.php' + missing_import_mode: strict + +when@prod: + framework: + asset_mapper: + missing_import_mode: warn diff --git a/assets/app.js b/assets/app.js new file mode 100644 index 000000000..6112e57b4 --- /dev/null +++ b/assets/app.js @@ -0,0 +1,2 @@ +import './styles/app.css'; + diff --git a/assets/styles/app.css b/assets/styles/app.css new file mode 100644 index 000000000..5b09288ee --- /dev/null +++ b/assets/styles/app.css @@ -0,0 +1,7 @@ +body { + background-color: #ddd; + color: #3e3d40; + font-family: helvetica,arial,sans-serif; + font-size: 1.3em; + line-height: 1.54; +} diff --git a/composer.json b/composer.json index 6d6e0e5e1..6d6477b17 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "setasign/tfpdf": "^1.33", "smarty/smarty": "^5.4", "symfony/asset": "7.3.*", + "symfony/asset-mapper": "7.3.*", "symfony/clock": "7.3.*", "symfony/console": "7.3.*", "symfony/expression-language": "7.3.*", @@ -60,6 +61,7 @@ "symfony/security-bundle": "7.3.*", "symfony/string": "7.3.*", "symfony/translation": "7.3.*", + "symfony/twig-pack": "^1.0", "symfony/validator": "7.3.*", "symfony/yaml": "7.3.*", "twig/extra-bundle": "^3.21", @@ -72,11 +74,13 @@ "scripts": { "post-install-cmd": [ "@php bin/console cache:clear --no-warmup", - "@php bin/console assets:install --relative htdocs" + "@php bin/console assets:install --relative htdocs", + "@php bin/console importmap:install" ], "post-update-cmd": [ "@php bin/console cache:clear --no-warmup", - "@php bin/console assets:install --relative htdocs" + "@php bin/console assets:install --relative htdocs", + "@php bin/console importmap:install" ] }, "config": { diff --git a/composer.lock b/composer.lock index f46142809..87d97dc62 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "db1e2f66b63744b8f523154cb74c66ed", + "content-hash": "71c83613c2238e2b9357bdcf349e2c11", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -848,6 +848,83 @@ ], "time": "2024-11-12T16:29:46+00:00" }, + { + "name": "composer/semver", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2025-08-20T19:15:30+00:00" + }, { "name": "cuyz/valinor", "version": "2.0.0", @@ -5481,16 +5558,16 @@ }, { "name": "symfony/asset", - "version": "v7.3.0", + "version": "v7.3.10", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "56c4d9f759247c4e07d8549e3baf7493cb9c3e4b" + "reference": "da95c6aba17f7e831744c2a09fd360e32a3d0f84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/56c4d9f759247c4e07d8549e3baf7493cb9c3e4b", - "reference": "56c4d9f759247c4e07d8549e3baf7493cb9c3e4b", + "url": "https://api.github.com/repos/symfony/asset/zipball/da95c6aba17f7e831744c2a09fd360e32a3d0f84", + "reference": "da95c6aba17f7e831744c2a09fd360e32a3d0f84", "shasum": "" }, "require": { @@ -5530,7 +5607,91 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v7.3.0" + "source": "https://github.com/symfony/asset/tree/v7.3.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-01-13T10:28:39+00:00" + }, + { + "name": "symfony/asset-mapper", + "version": "v7.3.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/asset-mapper.git", + "reference": "8325b9e34ad1b03c9a8a8414f215ea24949e1207" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/8325b9e34ad1b03c9a8a8414f215ea24949e1207", + "reference": "8325b9e34ad1b03c9a8a8414f215ea24949e1207", + "shasum": "" + }, + "require": { + "composer/semver": "^3.0", + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^7.1", + "symfony/http-client": "^6.4|^7.0" + }, + "conflict": { + "symfony/framework-bundle": "<6.4" + }, + "require-dev": { + "symfony/asset": "^6.4|^7.0", + "symfony/browser-kit": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/event-dispatcher-contracts": "^3.0", + "symfony/finder": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/web-link": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\AssetMapper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Maps directories of assets & makes them available in a public directory with versioned filenames.", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/asset-mapper/tree/v7.3.10" }, "funding": [ { @@ -5541,12 +5702,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-03-05T10:15:41+00:00" + "time": "2026-01-13T08:38:55+00:00" }, { "name": "symfony/cache", @@ -9879,6 +10044,51 @@ ], "time": "2025-09-10T12:00:31+00:00" }, + { + "name": "symfony/twig-pack", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-pack.git", + "reference": "08a73e833e07921c464336deb7630f93e85ef930" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-pack/zipball/08a73e833e07921c464336deb7630f93e85ef930", + "reference": "08a73e833e07921c464336deb7630f93e85ef930", + "shasum": "" + }, + "require": { + "symfony/twig-bundle": "*", + "twig/extra-bundle": "^2.12|^3.0", + "twig/twig": "^2.12|^3.0" + }, + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A Twig pack for Symfony projects", + "support": { + "issues": "https://github.com/symfony/twig-pack/issues", + "source": "https://github.com/symfony/twig-pack/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-19T08:46:41+00:00" + }, { "name": "symfony/type-info", "version": "v7.3.4", @@ -11055,83 +11265,6 @@ ], "time": "2022-12-23T10:58:28+00:00" }, - { - "name": "composer/semver", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", - "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.11", - "symfony/phpunit-bridge": "^3 || ^7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - } - ], - "time": "2025-08-20T19:15:30+00:00" - }, { "name": "composer/xdebug-handler", "version": "3.0.5", diff --git a/htdocs/templates/site/scss/base/layout.scss b/htdocs/templates/site/scss/base/layout.scss index fa3eee675..f9f835a5e 100644 --- a/htdocs/templates/site/scss/base/layout.scss +++ b/htdocs/templates/site/scss/base/layout.scss @@ -2,14 +2,6 @@ html { font-size: 62.5% } -body { - background-color: #ddd; - color: #3e3d40; - font-family: helvetica, arial, sans-serif; - font-size: 1.3em; - line-height: 1.54 -} - #main { padding: 0 30px } diff --git a/importmap.php b/importmap.php new file mode 100644 index 000000000..70ebf14f0 --- /dev/null +++ b/importmap.php @@ -0,0 +1,19 @@ + [ + 'path' => './assets/app.js', + 'entrypoint' => true, + ], +]; diff --git a/templates/base.html.twig b/templates/base.html.twig index 1c4cd0849..c34fd2608 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -58,5 +58,6 @@ {% block footer '' %} {% block javascripts '' %} + {% block importmap %}{{ importmap('app') }}{% endblock %}