-
-
Notifications
You must be signed in to change notification settings - Fork 491
Add server option for dev & prod in asset_mapper.yaml #1396
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
Conversation
for remove problem with access files in dev mode
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. symfony/asset-mapper6.3 vs 6.4diff --git a/symfony/asset-mapper/6.3/assets/app.js b/symfony/asset-mapper/6.4/assets/app.js
index cb0082a..6174cc6 100644
--- a/symfony/asset-mapper/6.3/assets/app.js
+++ b/symfony/asset-mapper/6.4/assets/app.js
@@ -4,4 +4,6 @@
* This file will be included onto the page via the importmap() Twig function,
* which should already be in your base.html.twig.
*/
-console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉')
+import './styles/app.css';
+
+console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
diff --git a/symfony/asset-mapper/6.3/config/packages/asset_mapper.yaml b/symfony/asset-mapper/6.4/config/packages/asset_mapper.yaml
index d1ac653..6eda28b 100644
--- a/symfony/asset-mapper/6.3/config/packages/asset_mapper.yaml
+++ b/symfony/asset-mapper/6.4/config/packages/asset_mapper.yaml
@@ -3,3 +3,11 @@ framework:
# The paths to make available to the asset mapper.
paths:
- assets/
+ missing_import_mode: strict
+ server: true
+
+when@prod:
+ framework:
+ asset_mapper:
+ server: false
+ missing_import_mode: warn
diff --git a/symfony/asset-mapper/6.3/importmap.php b/symfony/asset-mapper/6.4/importmap.php
index 5c2c21d..70ebf14 100644
--- a/symfony/asset-mapper/6.3/importmap.php
+++ b/symfony/asset-mapper/6.4/importmap.php
@@ -1,21 +1,19 @@
<?php
/**
- * Returns the import map for this application.
+ * 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.
*
- * - "preload" set to true for any modules that are loaded on the initial
- * page load to help the browser download them earlier.
+ * - "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.
- *
- * This file has been auto-generated by the importmap commands.
*/
return [
'app' => [
- 'path' => 'app.js',
- 'preload' => true,
+ 'path' => './assets/app.js',
+ 'entrypoint' => true,
],
];
diff --git a/symfony/asset-mapper/6.3/manifest.json b/symfony/asset-mapper/6.4/manifest.json
index c6fb477..7454a3d 100644
--- a/symfony/asset-mapper/6.3/manifest.json
+++ b/symfony/asset-mapper/6.4/manifest.json
@@ -6,22 +6,19 @@
},
"aliases": ["asset-mapper", "importmap"],
"gitignore": [
- "/%PUBLIC_DIR%/assets/"
+ "/%PUBLIC_DIR%/assets/",
+ "/assets/vendor/"
],
+ "composer-scripts": {
+ "importmap:install": "symfony-cmd"
+ },
"add-lines": [
{
"file": "templates/base.html.twig",
- "content": " {{ importmap() }}",
+ "content": " {% block importmap %}{{ importmap('app') }}{% endblock %}",
"position": "after_target",
"target": "{% block javascripts %}",
"warn_if_missing": true
- },
- {
- "file": "templates/base.html.twig",
- "content": " <link rel=\"stylesheet\" href=\"{{ asset('styles/app.css') }}\">",
- "position": "after_target",
- "target": "{% block stylesheets %}",
- "warn_if_missing": true
}
],
"conflict": { |
Why not relying on the default value of this parameter, which is |
good idea ;-) it's simple and clean |
and that's already the current behavior (as that's the default value of this setting when not specified). So I think this PR should just be closed. |
Pull request was closed
for remove problem with access files in dev mode