-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] WebAsset cross-dependencies support #42681
base: 5.3-dev
Are you sure you want to change the base?
Conversation
I think that make it much less verbose and unnecessary bloated. We have one drawback if you don't want the style you have to override the style which might not be a problem. Is introducing a cross dependency property really needed? wouldn't it be possible to add array syntax to dependency key? |
This will make code much more complicated and probably slower, also b/c is questionable. |
not so sure if it would be significant slower than parsing json already :-)
which is btw a much cleaner way than
which does basically the same but only for presets right? supporting this syntax for all types of assets would reduce code to maintain and allow flexibility or I'm wrong? I mean if you run a check |
I not sure that I understood you correctly :)
It is simple: you always use In the core we have only a few asset that actualy use it. It is more like an addittion, and not a replacement. Your sugestion sounds like we need to re-define how the dependecies is working. And we will be need to introduce some deprecations and have a mixed code/logic for the time of transition. I am not fan of it. |
I have added "example" in to description |
Okay, I found a way of doinng But I do not very like that. {
"name": "foobar",
"type": "preset",
"dependecies":["foo", "foo#style", "foo#script"]
} Currently :
After requested changes:
That will break code when someone use this preset outside of AssetManager. I think use of extra property allow us to introduce this feature without extra hassle. {
"name": "foobar",
"type": "preset",
"dependecies":["foo"],
"crossDependecies":["foo#style", "foo#script"]
} (It also will be a b.c., but more controllable, because it wil affect only presets edited in json, instead of every existing preset) What is your thought? |
Conflicts: administrator/components/com_modules/tmpl/modules/default_batch_body.php administrator/components/com_templates/tmpl/template/default_modal_child_body.php components/com_finder/tmpl/search/default_form.php
Conflicts: libraries/src/WebAsset/WebAssetItem.php
This pull request has been automatically rebased to 5.3-dev. |
Summary of Changes
Implementing cross-dependencies for assets.
Means now the
script
asset can have astyle
asset in dependency, and vise versa (but not in the loop of course).@wilsonge @HLeithner what do you think?
Example:
Here calling
$wa->useScript('foo')
will enable all 4 assets.Testing Instructions
Apply patch, run
npm install
,Edit article, and use tag field.
Edit module, and use module position field.
Use smart search with autocomplete enabled.
Actual result BEFORE applying this Pull Request
Works
Expected result AFTER applying this Pull Request
Works
Link to documentations
Please select:
References: