Skip to content

Commit 8569b39

Browse files
authored
Merge pull request #28 from xabbuh/asset-mapper-recipe
install the AssetMapper recipe
2 parents 6567d66 + c1acc03 commit 8569b39

File tree

6 files changed

+47
-23
lines changed

6 files changed

+47
-23
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020
npm-debug.log
2121
yarn-error.log
2222
###< symfony/webpack-encore-bundle ###
23-
composer.lock
23+
composer.lock
24+
###> symfony/asset-mapper ###
25+
/public/assets/
26+
/assets/vendor/
27+
###< symfony/asset-mapper ###

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
"scripts": {
8787
"auto-scripts": {
8888
"cache:clear": "symfony-cmd",
89-
"assets:install %PUBLIC_DIR%": "symfony-cmd"
89+
"assets:install %PUBLIC_DIR%": "symfony-cmd",
90+
"importmap:install": "symfony-cmd"
9091
},
9192
"post-install-cmd": [
9293
"@auto-scripts"

config/packages/asset_mapper.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
framework:
2+
asset_mapper:
3+
# The paths to make available to the asset mapper.
4+
paths:
5+
- assets/

importmap.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* Returns the importmap for this application.
5+
*
6+
* - "path" is a path inside the asset mapper system. Use the
7+
* "debug:asset-map" command to see the full list of paths.
8+
*
9+
* - "entrypoint" (JavaScript only) set to true for any module that will
10+
* be used as an "entrypoint" (and passed to the importmap() Twig function).
11+
*
12+
* The "importmap:require" command can be used to add new entries to this file.
13+
*/
14+
return [
15+
'app' => [
16+
'path' => './assets/app.js',
17+
'entrypoint' => true,
18+
],
19+
];

symfony.lock

+15-21
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@
119119
"psr/event-dispatcher": {
120120
"version": "1.0.0"
121121
},
122-
"psr/event-dispatcher": {
123-
"version": "1.0.0"
124-
},
125122
"psr/link": {
126123
"version": "1.1.1"
127124
},
@@ -146,6 +143,21 @@
146143
"symfony/asset": {
147144
"version": "v5.4.0"
148145
},
146+
"symfony/asset-mapper": {
147+
"version": "7.1",
148+
"recipe": {
149+
"repo": "github.com/symfony/recipes",
150+
"branch": "main",
151+
"version": "6.4",
152+
"ref": "6c28c471640cc2c6e60812ebcb961c526ef8997f"
153+
},
154+
"files": [
155+
"assets/app.js",
156+
"assets/styles/app.css",
157+
"config/packages/asset_mapper.yaml",
158+
"importmap.php"
159+
]
160+
},
149161
"symfony/browser-kit": {
150162
"version": "v5.4.0"
151163
},
@@ -282,18 +294,6 @@
282294
"config/packages/lock.yaml"
283295
]
284296
},
285-
"symfony/lock": {
286-
"version": "6.0",
287-
"recipe": {
288-
"repo": "github.com/symfony/recipes",
289-
"branch": "master",
290-
"version": "5.2",
291-
"ref": "a1c8800e40ae735206bb14586fdd6c4630a51b8d"
292-
},
293-
"files": [
294-
"config/packages/lock.yaml"
295-
]
296-
},
297297
"symfony/mailer": {
298298
"version": "5.4",
299299
"recipe": {
@@ -435,9 +435,6 @@
435435
"symfony/proxy-manager-bridge": {
436436
"version": "v5.4.0"
437437
},
438-
"symfony/rate-limiter": {
439-
"version": "v5.4.0"
440-
},
441438
"symfony/rate-limiter": {
442439
"version": "v6.0.0"
443440
},
@@ -525,9 +522,6 @@
525522
"templates/base.html.twig"
526523
]
527524
},
528-
"symfony/uid": {
529-
"version": "v5.4.0"
530-
},
531525
"symfony/uid": {
532526
"version": "v6.0.0"
533527
},

templates/base.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{% endblock %}
1111

1212
{% block javascripts %}
13+
{% block importmap %}{{ importmap('app') }}{% endblock %}
1314
{#{{ encore_entry_script_tags('app') }}#}
1415
{% endblock %}
1516
</head>

0 commit comments

Comments
 (0)