Skip to content

Redo #134, Add importmap info to WebAsset manual#320

Merged
Fedik merged 2 commits intojoomla:mainfrom
Fedik:redo-134
Oct 14, 2024
Merged

Redo #134, Add importmap info to WebAsset manual#320
Fedik merged 2 commits intojoomla:mainfrom
Fedik:redo-134

Conversation

@Fedik
Copy link
Copy Markdown
Member

@Fedik Fedik commented Oct 14, 2024

User description

It is redo of #134, which is disapiered from the manual in some reason.
Merge conflict?


PR Type

Documentation


Description

  • Added detailed documentation on working with ESM importmap in the WebAsset Manager.
  • Explained the configuration options for importmap, including importmap, importmapName, and importmapScope.
  • Provided methods to work with ESM importmap similar to script asset items.
  • Updated documentation across multiple versions to ensure consistency.

Changes walkthrough 📝

Relevant files
Documentation
web-asset-manager.md
Add ESM importmap documentation to WebAsset Manager           

docs/general-concepts/web-asset-manager.md

  • Added a section on working with ESM importmap.
  • Explained how to define importmap for ES modules.
  • Listed options for importmap configuration.
  • Described methods to work with ESM importmap.
  • +9/-0     
    web-asset-manager.md
    Add ESM importmap documentation to WebAsset Manager           

    versioned_docs/version-5.0/general-concepts/web-asset-manager.md

  • Added a section on working with ESM importmap.
  • Explained how to define importmap for ES modules.
  • Listed options for importmap configuration.
  • Described methods to work with ESM importmap.
  • +9/-0     
    web-asset-manager.md
    Add ESM importmap documentation to WebAsset Manager           

    versioned_docs/version-5.1/general-concepts/web-asset-manager.md

  • Added a section on working with ESM importmap.
  • Explained how to define importmap for ES modules.
  • Listed options for importmap configuration.
  • Described methods to work with ESM importmap.
  • +9/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @qodo-code-review qodo-code-review bot added the documentation Improvements or additions to documentation label Oct 14, 2024
    @qodo-code-review
    Copy link
    Copy Markdown
    Contributor

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis 🔶

    134 - Partially compliant

    Fully compliant requirements:

    • Add importmap info to WebAsset manual

    Not compliant requirements:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Consistency
    Ensure that the added content is consistent across all versions of the documentation

    Clarity
    Verify if the explanation of importmap options is clear and comprehensive enough for users

    @qodo-code-review
    Copy link
    Copy Markdown
    Contributor

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Provide more detailed information about methods for working with ESM importmap

    Expand on the methods available for working with ESM importmap, providing more
    details or examples of common operations.

    docs/general-concepts/web-asset-manager.md [574-575]

     ### 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.

    docs/general-concepts/web-asset-manager.md [568-573]

     ## 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.

    docs/general-concepts/web-asset-manager.md [568-569]

     ## 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.

    6

    💡 Need additional feedback ? start a PR chat

    @Fedik Fedik merged commit 32faa30 into joomla:main Oct 14, 2024
    @Fedik Fedik deleted the redo-134 branch October 14, 2024 10:26
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    documentation Improvements or additions to documentation Review effort [1-5]: 2

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant