Skip to content

Commit

Permalink
Redo #134, Add importmap info to WebAsset manual (#320)
Browse files Browse the repository at this point in the history
* Add importmap info to WebAsset manual

* Add importmap info to WebAsset manual
  • Loading branch information
Fedik authored Oct 14, 2024
1 parent a8fcd42 commit 32faa30
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/general-concepts/web-asset-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,15 @@ Will produce:
A named inline asset may be a dependency to another inline asset, however it is not recommended to use an inline asset as dependency to non-inline asset. This will work, but this behavior may change in the future. It's recommended to use "position" instead.
:::
## 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:
- `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`;
### 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.
## Working with a web component
Joomla! allows you to use [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) for your needs. In Joomla! web components are not loaded as regular scripts, but loaded via Web Component loader so that they are loaded asynchronously.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,15 @@ Will produce:
A named inline asset may be a dependency to another inline asset, however it is not recommended to use an inline asset as dependency to non-inline asset. This will work, but this behavior may change in the future. It's recommended to use "position" instead.
:::
## 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:
- `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`;
### 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.
## Working with a web component
Joomla! allows you to use [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) for your needs. In Joomla! web components are not loaded as regular scripts, but loaded via Web Component loader so that they are loaded asynchronously.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,15 @@ Will produce:
A named inline asset may be a dependency to another inline asset, however it is not recommended to use an inline asset as dependency to non-inline asset. This will work, but this behavior may change in the future. It's recommended to use "position" instead.
:::
## 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:
- `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`;
### 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.
## Working with a web component
Joomla! allows you to use [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) for your needs. In Joomla! web components are not loaded as regular scripts, but loaded via Web Component loader so that they are loaded asynchronously.
Expand Down

0 comments on commit 32faa30

Please sign in to comment.