Skip to content
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

install the AssetMapper recipe #28

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
composer.lock
composer.lock
###> symfony/asset-mapper ###
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions config/packages/asset_mapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework:
asset_mapper:
# The paths to make available to the asset mapper.
paths:
- assets/
19 changes: 19 additions & 0 deletions importmap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* Returns the importmap for this application.
*
* - "path" is a path inside the asset mapper system. Use the
* "debug:asset-map" command to see the full list of paths.
*
* - "entrypoint" (JavaScript only) set to true for any module that will
* be used as an "entrypoint" (and passed to the importmap() Twig function).
*
* The "importmap:require" command can be used to add new entries to this file.
*/
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
];
36 changes: 15 additions & 21 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/link": {
"version": "1.1.1"
},
Expand All @@ -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"
},
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down Expand Up @@ -525,9 +522,6 @@
"templates/base.html.twig"
]
},
"symfony/uid": {
"version": "v5.4.0"
},
"symfony/uid": {
"version": "v6.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{% endblock %}

{% block javascripts %}
{% block importmap %}{{ importmap('app') }}{% endblock %}
{#{{ encore_entry_script_tags('app') }}#}
{% endblock %}
</head>
Expand Down
Loading