Skip to content

Commit dc52796

Browse files
tacmanweaverryan
andauthored
fix importmap for assetmapper 6.4 (#1245)
* fix default importmap * fix paths and add entrypoint comment * remove adding stylesheet line in base.html.twig * Update symfony/asset-mapper/6.4/manifest.json Co-authored-by: Ryan Weaver <[email protected]> * ignore assets/vendor * revert to 6.3 --------- Co-authored-by: Ryan Weaver <[email protected]>
1 parent 285a9ab commit dc52796

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Welcome to your app's main JavaScript file!
3+
*
4+
* This file will be included onto the page via the importmap() Twig function,
5+
* which should already be in your base.html.twig.
6+
*/
7+
import './styles/app.css'
8+
9+
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-color: skyblue;
3+
}
Lines changed: 5 additions & 0 deletions
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/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/**
4+
* Returns the import map 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+
* This file has been auto-generated by the importmap commands.
15+
*/
16+
return [
17+
'app' => [
18+
'path' => './assets/app.js',
19+
'entrypoint' => true,
20+
],
21+
];
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"copy-from-recipe": {
3+
"assets/": "assets/",
4+
"config/": "%CONFIG_DIR%/",
5+
"importmap.php": "importmap.php"
6+
},
7+
"aliases": ["asset-mapper", "importmap"],
8+
"gitignore": [
9+
"/%PUBLIC_DIR%/assets/",
10+
"/assets/vendor"
11+
],
12+
"add-lines": [
13+
{
14+
"file": "templates/base.html.twig",
15+
"content": " {{ importmap('app') }}",
16+
"position": "after_target",
17+
"target": "{% block javascripts %}",
18+
"warn_if_missing": true
19+
}
20+
],
21+
"conflict": {
22+
"symfony/framework-bundle": "<6.3",
23+
"symfony/twig-bundle": "<6.3",
24+
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
25+
}
26+
}

0 commit comments

Comments
 (0)