[4.0] [RFC] WebAsset custom class per asset, and asset behavior#23743
Merged
wilsonge merged 8 commits intojoomla:4.0-devfrom May 5, 2019
Merged
[4.0] [RFC] WebAsset custom class per asset, and asset behavior#23743wilsonge merged 8 commits intojoomla:4.0-devfrom
wilsonge merged 8 commits intojoomla:4.0-devfrom
Conversation
Contributor
|
It's a YES from me 😉 |
Conflicts: libraries/src/WebAsset/WebAssetManager.php libraries/src/WebAsset/WebAssetManagerInterface.php
Contributor
|
Please can you add docs for this on the web asset docs page |
Member
Author
|
@wilsonge I have added a new chapter https://docs.joomla.org/J4.x:Web_Assets |
Contributor
|
Tweaked english. Was really good. Thanks! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of Changes
I want to suggest an idea.
The WebAsset can have a custom class. Actually it already possible, but was not possible while loading assets from json.
Additionally introduce
WebAssetAttachBehaviorInterface, this can be useful when Asset need to have a Script options with a values that depend from environment. Example of old: 'behavior.core', 'behavior.keepalive'.This also allow to leave in the past old
JHtmlBehavior, at least in the part for loading a scripts.Look for example
https://github.com/Fedik/joomla-cms/blob/be02eea44e9d5cd4aebbba12d98ec8bacf50ebbd/libraries/src/WebAsset/AssetItem/CoreAssetItem.php#L36-L49
and
https://github.com/Fedik/joomla-cms/blob/be02eea44e9d5cd4aebbba12d98ec8bacf50ebbd/libraries/src/WebAsset/AssetItem/KeepaliveAssetItem.php#L24
ping @wilsonge @dgrammatiko
@mbabker I think it will be cooler than WP_Dependencies no? 😉
Testing Instructions
run
npm installandmake sure everything works as before.
Documentation Changes Required
as part of #22435