No Code Attached Yet
avatar PhocaCz
PhocaCz
30 Sep 2021

Steps to reproduce the issue

  • Create user.css in template - in templates/cassiopeia/css/user.css
  • Load some CSS in some extension, example:

HTMLHelper::_('stylesheet', 'media/com_phocacart/css/main.css', array('version' => 'auto'));

Expected result

User.css will be loaded after component CSS (main.css)

Actual result

User.css is loaded before component CSS (main.css)

img

System information (as much as possible)

Joomla 4.0.2

Additional comments

avatar PhocaCz PhocaCz - open - 30 Sep 2021
avatar joomla-cms-bot joomla-cms-bot - change - 30 Sep 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Sep 2021
avatar Fedik
Fedik - comment - 30 Sep 2021

Please try WebAsset instead https://docs.joomla.org/J4.x:Web_Assets
All call of HTMLHelper::_('stylesheet or script', ... still works, but they attached last.

avatar PhocaCz
PhocaCz - comment - 30 Sep 2021

Hi, thank you for the info.

$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->registerAndUseStyle('com_phocacart', 'media/com_phocacart/css/main.css');

This did the trick. But the question is how many developers will use this latest method if the standard methods still work.

avatar Fedik
Fedik - comment - 30 Sep 2021

Many of them, that a question of the time.
We cannot easily drop the old way. For j4.

avatar Fedik Fedik - change - 30 Sep 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-09-30 20:17:29
Closed_By Fedik
avatar Fedik Fedik - close - 30 Sep 2021

Add a Comment

Login with GitHub to post a comment