You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Methods to work with ESM importmap
-All methods to work with a ESM importmap are the same as methods to work with script asset item.+All methods to work with an ESM importmap are the same as methods to work with script asset items. These include:+- `registerScript()`: Register a new script asset with importmap options+- `useScript()`: Use a registered script asset in the current context+- `disableScript()`: Disable a previously registered script asset+- `getScripts()`: Retrieve all registered script assets, including those with importmap configurations++Example:+```php+$wa->registerScript('myModule', 'path/to/myModule.js', [], ['type' => 'module', 'importmap' => true]);+$wa->useScript('myModule');+```+
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Expanding on the methods available for working with ESM importmap, along with examples, significantly improves the documentation by giving users a clearer understanding of how to utilize these methods effectively.
8
Add a practical example to illustrate the usage of importmap options
Consider providing a brief example of how to use the importmap options in practice. This would help users better understand how to implement these features in their own projects.
## Working with ESM importmap
WebAssetManager allows to define [importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) for your ES modules.
-The `script` asset with option `"importmap": true` will be added to `importmap`. Other option available:+The `script` asset with option `"importmap": true` will be added to `importmap`. Other options available:
- `importmap` boolean, whether the element should be added to `importmap`;
- `importmapName` string, optional, custom module name, example when asset name `foo`, and module name is `@foo`;
- `importmapScope` string, optional, a scope path for the asset in `importmap`;
+Example usage:+```php+$wa->registerScript('myModule', 'path/to/myModule.js', [], ['type' => 'module', 'importmap' => true, 'importmapName' => '@myCustomName']);+```+
Apply this suggestion
Suggestion importance[1-10]: 7
Why: Providing a practical example enhances the documentation by offering users a concrete illustration of how to implement importmap options, improving understanding and usability.
7
Explain the benefits of using importmap in Joomla's WebAssetManager
Consider adding a brief explanation of the benefits of using importmap in the context of Joomla's WebAssetManager to help users understand why they might want to use this feature.
## Working with ESM importmap
-WebAssetManager allows to define [importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) for your ES modules.+WebAssetManager allows you to define [importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) for your ES modules. Using importmap can improve your application's performance and maintainability by:+- Simplifying module specifiers+- Allowing easier version management of external dependencies+- Enabling more efficient loading of ES modules+Here's how you can use importmap with WebAssetManager:+
Apply this suggestion
Suggestion importance[1-10]: 6
Why: Adding an explanation of the benefits of using importmap provides valuable context, helping users understand the advantages and encouraging them to adopt this feature in their projects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
It is redo of #134, which is disapiered from the manual in some reason.
Merge conflict?
PR Type
Documentation
Description
importmap,importmapName, andimportmapScope.Changes walkthrough 📝
web-asset-manager.md
Add ESM importmap documentation to WebAsset Managerdocs/general-concepts/web-asset-manager.md
web-asset-manager.md
Add ESM importmap documentation to WebAsset Managerversioned_docs/version-5.0/general-concepts/web-asset-manager.md
web-asset-manager.md
Add ESM importmap documentation to WebAsset Managerversioned_docs/version-5.1/general-concepts/web-asset-manager.md