@@ -68,8 +68,11 @@ public function testCompileFindsCorrectImports(string $input, array $expectedJav
68
68
->willReturnCallback (function ($ path ) {
69
69
return match ($ path ) {
70
70
'/project/assets/foo.js ' => new MappedAsset ('foo.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/foo.js ' ),
71
+ '/project/assets/bootstrap.js ' => new MappedAsset ('bootstrap.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/bootstrap.js ' ),
71
72
'/project/assets/other.js ' => new MappedAsset ('other.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/other.js ' ),
72
73
'/project/assets/subdir/foo.js ' => new MappedAsset ('subdir/foo.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/subdir/foo.js ' ),
74
+ '/project/assets/styles/app.css ' => new MappedAsset ('styles/app.css ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/styles/app.css ' ),
75
+ '/project/assets/styles/app.scss ' => new MappedAsset ('styles/app.scss ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/styles/app.scss ' ),
73
76
'/project/assets/styles.css ' => new MappedAsset ('styles.css ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/styles.css ' ),
74
77
'/project/assets/vendor/module_in_importmap_remote.js ' => new MappedAsset ('module_in_importmap_remote.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/module_in_importmap_remote.js ' ),
75
78
'/project/assets/vendor/@popperjs/core.js ' => new MappedAsset ('assets/vendor/@popperjs/core.js ' , '/can/be/anything.js ' , publicPathWithoutDigest: '/assets/@popperjs/core.js ' ),
@@ -90,6 +93,26 @@ public function testCompileFindsCorrectImports(string $input, array $expectedJav
90
93
91
94
public static function provideCompileTests (): iterable
92
95
{
96
+ yield 'standard_symfony_app_js ' => [
97
+ 'input ' => <<<EOF
98
+ import './bootstrap.js';
99
+
100
+ /*
101
+ * Welcome to your app's main JavaScript file!
102
+ *
103
+ * This file will be included onto the page via the importmap() Twig function,
104
+ * which should already be in your base.html.twig.
105
+ */
106
+ import './styles/app.css';
107
+
108
+ console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
109
+ EOF ,
110
+ 'expectedJavaScriptImports ' => [
111
+ '/assets/bootstrap.js ' => ['lazy ' => false , 'asset ' => 'bootstrap.js ' , 'add ' => true ],
112
+ '/assets/styles/app.css ' => ['lazy ' => false , 'asset ' => 'styles/app.css ' , 'add ' => true ],
113
+ ],
114
+ ];
115
+
93
116
yield 'dynamic_simple_double_quotes ' => [
94
117
'input ' => 'import("./other.js"); ' ,
95
118
'expectedJavaScriptImports ' => ['/assets/other.js ' => ['lazy ' => true , 'asset ' => 'other.js ' , 'add ' => true ]],
0 commit comments