diff --git a/.gitignore b/.gitignore index 64c6627..5fb8656 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,11 @@ yarn-error.log phpstan.neon ###< phpstan/phpstan ### .phpunit.cache + +###> symfony/asset-mapper ### +/public/assets/ +/assets/vendor/ +###< symfony/asset-mapper ### + .twig-cs-fixer.cache .playwright-mcp diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ee3096..1d3c760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [#81](https://github.com/itk-dev/devops_itksites/pull/81) 5564: Asset Mapper migration + - Add Symfony Asset Mapper bundle and importmap + ## [1.11.0] - 2026-05-19 - [#78](https://github.com/itk-dev/devops_itksites/pull/78) diff --git a/assets/app.js b/assets/app.js new file mode 100644 index 0000000..e2824a5 --- /dev/null +++ b/assets/app.js @@ -0,0 +1,9 @@ +/* + * Welcome to your app's main JavaScript file! + * + * This file will be included onto the page via the importmap() Twig function, + * which should already be in your base.html.twig. + */ +import "./styles/app.css"; + +console.log("This log comes from assets/app.js - welcome to AssetMapper! 🎉"); diff --git a/assets/styles/app.css b/assets/styles/app.css new file mode 100644 index 0000000..8218dc7 --- /dev/null +++ b/assets/styles/app.css @@ -0,0 +1,28 @@ +:root { + --body-max-width: 100%; + --sidebar-bg: #fff; + /* make the base font size smaller */ + --button-primary-bg: rgb(0, 123, 166); + --pagination-active-bg: rgb(0, 123, 166); + --link-color: rgb(0, 123, 166); + --sidebar-menu-active-item-color: rgb(0, 123, 166); + --badge-boolean-true-bg: rgb(0, 123, 166); + --badge-boolean-false-bg: rgb(228, 73, 48); + --badge-boolean-false-color: var(--white); + --sidebar-menu-color: rgb(66, 66, 66); + --text-color-dark: rgb(66, 66, 66); + --bs-danger-rgb: 228, 73, 48; +} + +/* Grouped dropdown group styling for index pages */ +.dropdown-menu { + .btn-danger i, + .text-danger i { + color: var(--button-invisible-danger-color); + } + + a.btn-danger:hover, + a.text-danger:hover { + background: var(--button-invisible-danger-hover-hover-bg); + } +} diff --git a/composer.json b/composer.json index 1737658..efe1ca0 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "phpstan/phpdoc-parser": "^2.0", "symfony/amqp-messenger": "^8.0", "symfony/asset": "^8.0", + "symfony/asset-mapper": "~8.0.0", "symfony/browser-kit": "^8.0", "symfony/console": "^8.0", "symfony/doctrine-messenger": "^8.0", @@ -111,7 +112,8 @@ ], "auto-scripts": { "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "importmap:install": "symfony-cmd" }, "coding-standards-apply": [ "vendor/bin/php-cs-fixer fix" diff --git a/composer.lock b/composer.lock index 9392a9d..277f9e3 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": "d3d28912efc62de1dcb6b25446712071", + "content-hash": "2a1b30ad222f086b612ec724b183c9eb", "packages": [ { "name": "api-platform/core", @@ -3317,6 +3317,87 @@ ], "time": "2026-03-30T15:14:47+00:00" }, + { + "name": "symfony/asset-mapper", + "version": "v8.0.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/asset-mapper.git", + "reference": "b2c33bf6934bfe5b37a6d70d0b0f7011d0ec4a0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/b2c33bf6934bfe5b37a6d70d0b0f7011d0ec4a0c", + "reference": "b2c33bf6934bfe5b37a6d70d0b0f7011d0ec4a0c", + "shasum": "" + }, + "require": { + "composer/semver": "^3.0", + "php": ">=8.4", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0" + }, + "require-dev": { + "symfony/asset": "^7.4|^8.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/event-dispatcher-contracts": "^3.0", + "symfony/finder": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.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/v8.0.11" + }, + "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-05-13T12:07:53+00:00" + }, { "name": "symfony/browser-kit", "version": "v8.0.8", diff --git a/config/packages/asset_mapper.yaml b/config/packages/asset_mapper.yaml new file mode 100644 index 0000000..f7653e9 --- /dev/null +++ b/config/packages/asset_mapper.yaml @@ -0,0 +1,11 @@ +framework: + asset_mapper: + # The paths to make available to the asset mapper. + paths: + - assets/ + missing_import_mode: strict + +when@prod: + framework: + asset_mapper: + missing_import_mode: warn diff --git a/config/reference.php b/config/reference.php index a632abf..563c307 100644 --- a/config/reference.php +++ b/config/reference.php @@ -280,7 +280,7 @@ * }>, * }, * asset_mapper?: bool|array{ // Asset Mapper configuration - * enabled?: bool|Param, // Default: false + * enabled?: bool|Param, // Default: true * paths?: string|array, * excluded_patterns?: list, * exclude_dotfiles?: bool|Param, // If true, any files starting with "." will be excluded from the asset mapper. // Default: true diff --git a/importmap.php b/importmap.php new file mode 100644 index 0000000..70ebf14 --- /dev/null +++ b/importmap.php @@ -0,0 +1,19 @@ + [ + 'path' => './assets/app.js', + 'entrypoint' => true, + ], +]; diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index bedf5ac..0000000 --- a/psalm.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/public/css/admin.css b/public/css/admin.css deleted file mode 100644 index 853c0f8..0000000 --- a/public/css/admin.css +++ /dev/null @@ -1,15 +0,0 @@ -:root { - --body-max-width: 100%; - --sidebar-bg: #fff; - /* make the base font size smaller */ - --button-primary-bg: rgb(0,123,166); - --pagination-active-bg: rgb(0,123,166); - --link-color: rgb(0,123,166); - --sidebar-menu-active-item-color: rgb(0,123,166); - --badge-boolean-true-bg: rgb(0,123,166); - --badge-boolean-false-bg: rgb(228, 73, 48); - --badge-boolean-false-color: var(--white); - --sidebar-menu-color: rgb(66,66,66); - --text-color-dark: rgb(66,66,66); - --bs-danger-rgb: 228, 73, 48; -} \ No newline at end of file diff --git a/symfony.lock b/symfony.lock index 1033474..4e95b38 100644 --- a/symfony.lock +++ b/symfony.lock @@ -307,6 +307,21 @@ "symfony/asset": { "version": "v6.0.3" }, + "symfony/asset-mapper": { + "version": "7.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.4", + "ref": "5ad1308aa756d58f999ffbe1540d1189f5d7d14a" + }, + "files": [ + "assets/app.js", + "assets/styles/app.css", + "config/packages/asset_mapper.yaml", + "importmap.php" + ] + }, "symfony/browser-kit": { "version": "v6.0.3" },