Skip to content

Comments

[4.0] [RFC] WebAsset custom class per asset, and asset behavior#23743

Merged
wilsonge merged 8 commits intojoomla:4.0-devfrom
Fedik:asset-class
May 5, 2019
Merged

[4.0] [RFC] WebAsset custom class per asset, and asset behavior#23743
wilsonge merged 8 commits intojoomla:4.0-devfrom
Fedik:asset-class

Conversation

@Fedik
Copy link
Member

@Fedik Fedik commented Feb 2, 2019

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 install and
make sure everything works as before.

Documentation Changes Required

as part of #22435

@joomla-cms-bot joomla-cms-bot added PR-4.0-dev RFC Request for Comment labels Feb 2, 2019
@dgrammatiko
Copy link
Contributor

It's a YES from me 😉

@ghost ghost added the J4 Issue label Apr 5, 2019
@ghost ghost removed the J4 Issue label Apr 13, 2019
@ghost ghost changed the title [4.0][RFC] WebAsset custom class per asset, and asset behavior [4.0] [RFC] WebAsset custom class per asset, and asset behavior Apr 19, 2019
@joomla-cms-bot joomla-cms-bot added the NPM Resource Changed This Pull Request can't be tested by Patchtester label Apr 19, 2019
 Conflicts:
	libraries/src/WebAsset/WebAssetManager.php
	libraries/src/WebAsset/WebAssetManagerInterface.php
@wilsonge wilsonge merged commit bf1e0df into joomla:4.0-dev May 5, 2019
@wilsonge
Copy link
Contributor

wilsonge commented May 5, 2019

Please can you add docs for this on the web asset docs page

@wilsonge wilsonge added this to the Joomla 4.0 milestone May 5, 2019
@Fedik Fedik deleted the asset-class branch May 5, 2019 16:33
@Fedik
Copy link
Member Author

Fedik commented May 6, 2019

@wilsonge I have added a new chapter https://docs.joomla.org/J4.x:Web_Assets
please check, for my english 😉

@wilsonge
Copy link
Contributor

wilsonge commented May 7, 2019

Tweaked english. Was really good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NPM Resource Changed This Pull Request can't be tested by Patchtester RFC Request for Comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants