diff --git a/.gitignore b/.gitignore index 6a7987a..7c04f2c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,8 @@ npm-debug.log yarn-error.log ###< symfony/webpack-encore-bundle ### -composer.lock \ No newline at end of file +composer.lock +###> symfony/asset-mapper ### +/public/assets/ +/assets/vendor/ +###< symfony/asset-mapper ### diff --git a/composer.json b/composer.json index d51ed8e..e4a1688 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,8 @@ "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "importmap:install": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts" diff --git a/config/packages/asset_mapper.yaml b/config/packages/asset_mapper.yaml new file mode 100644 index 0000000..d1ac653 --- /dev/null +++ b/config/packages/asset_mapper.yaml @@ -0,0 +1,5 @@ +framework: + asset_mapper: + # The paths to make available to the asset mapper. + paths: + - assets/ 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/symfony.lock b/symfony.lock index 0d535c5..059d424 100644 --- a/symfony.lock +++ b/symfony.lock @@ -119,9 +119,6 @@ "psr/event-dispatcher": { "version": "1.0.0" }, - "psr/event-dispatcher": { - "version": "1.0.0" - }, "psr/link": { "version": "1.1.1" }, @@ -146,6 +143,21 @@ "symfony/asset": { "version": "v5.4.0" }, + "symfony/asset-mapper": { + "version": "7.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.4", + "ref": "6c28c471640cc2c6e60812ebcb961c526ef8997f" + }, + "files": [ + "assets/app.js", + "assets/styles/app.css", + "config/packages/asset_mapper.yaml", + "importmap.php" + ] + }, "symfony/browser-kit": { "version": "v5.4.0" }, @@ -282,18 +294,6 @@ "config/packages/lock.yaml" ] }, - "symfony/lock": { - "version": "6.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.2", - "ref": "a1c8800e40ae735206bb14586fdd6c4630a51b8d" - }, - "files": [ - "config/packages/lock.yaml" - ] - }, "symfony/mailer": { "version": "5.4", "recipe": { @@ -435,9 +435,6 @@ "symfony/proxy-manager-bridge": { "version": "v5.4.0" }, - "symfony/rate-limiter": { - "version": "v5.4.0" - }, "symfony/rate-limiter": { "version": "v6.0.0" }, @@ -525,9 +522,6 @@ "templates/base.html.twig" ] }, - "symfony/uid": { - "version": "v5.4.0" - }, "symfony/uid": { "version": "v6.0.0" }, diff --git a/templates/base.html.twig b/templates/base.html.twig index 16d7273..eb686a8 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -10,6 +10,7 @@ {% endblock %} {% block javascripts %} + {% block importmap %}{{ importmap('app') }}{% endblock %} {#{{ encore_entry_script_tags('app') }}#} {% endblock %}