Skip to content
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

[4.0] Added option 'order' to method addStyleSheet #23912

Closed
wants to merge 1 commit into from

Conversation

todordev
Copy link
Contributor

Summary of Changes

Added a code that will reorder stylesheet links if you provide an option 'order' to the method addStyleSheet().
That will be useful if you would like to overwrite default template styles.

Testing Instructions

Include CSS file from your view and set option 'order'.
For example:
$this->document->addStyleSheet('../media/fixform.css', ['order' => 6]);

addstylesheet_order

I am going to attach the file fixform.css, if you would like to use it for test.

Result

Without option 'order'.
before

With option 'order'.
after

fixform.css
fixform.zip

@mbabker
Copy link
Contributor

mbabker commented Feb 15, 2019

Being blunt here, I feel like time is better invested on the web asset API instead of adding what I personally equate to a core supported hack to the API. If you really need this fine grained level of control of stylesheets you can already resort the _styleSheets property at the onBeforeCompileHead event without adding another attribute to it. Specifying "I should render in slot 4" should not be the approach registering items, the logic should be "I should render after my dependencies", which is what the web asset API aims to accomplish. Even if someone decided this was a good idea to incorporate, how does it deal with the fact that there are umpteen thousand assets floating around the ecosystem and how does it prioritize 38 things having an order of 1 (which results in no real change)?

@Fedik
Copy link
Member

Fedik commented Feb 16, 2019

as @mbabker already said, just use WebAsset,
there no Doc currently, but for now can use #23463 #22435 as reference

@todordev
Copy link
Contributor Author

WebAsset is awesome feature!!! It's a wonderful solution for many of my issues. :)
Thank you very much!

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/23912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants