diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c14cee6..9dec7ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up PHP uses: shivammathur/setup-php@v2 @@ -20,7 +20,7 @@ jobs: coverage: none - name: Download dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v2 - name: Run tests run: ./bin/console cache:warmup --env dev 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 6ae3849..561d03b 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "symfony/validator": "*", "symfony/web-link": "*", "symfony/webpack-encore-bundle": "^2.1", + "symfony/workflow": "*", "symfony/yaml": "*", "twig/extra-bundle": "^3.0", "twig/twig": "^3.0" @@ -84,7 +85,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/config/packages/workflow.yaml b/config/packages/workflow.yaml new file mode 100644 index 0000000..855df59 --- /dev/null +++ b/config/packages/workflow.yaml @@ -0,0 +1,2 @@ +framework: + workflows: null 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 d6153e6..41e798a 100644 --- a/symfony.lock +++ b/symfony.lock @@ -125,6 +125,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" }, @@ -559,6 +574,18 @@ "webpack.config.js" ] }, + "symfony/workflow": { + "version": "5.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.3", + "ref": "3b2f8ca32a07fcb00f899649053943fa3d8bbfb6" + }, + "files": [ + "config/packages/workflow.yaml" + ] + }, "symfony/yaml": { "version": "v5.4.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 %}