Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Postponed
This issue is postponed on 8.1.x being open for development.
Example: remove all system stylesheets like this:
stylesheets-remove[] = system*
Comments
Comment #1
joelpittetComment #2
joelpittetComment #3
star-szrPostponing, this is a nice-to-have and could go into a future minor version of 8.x.x.
Comment #4
star-szrJust want to mention the fact that we are using libraries everywhere negates the need for this a bit in my opinion. Because libraries can contain a whole handful of CSS files that can be removed en masse.
Comment #5
Lukas von BlarerI agree that this is a feature request we could postpone. But the fact that the system module adds 40 CSS files, this would be quite annoying to have that in 8.1.x because these 40 lines of code will end up in every single project I create. Can we rethink this? It would be nice to be able to to this:
Comment #6
Lukas von BlarerSetting this back to active.
Comment #7
star-szrI think if we add this it should be to libraries-override, not stylesheets-remove. stylesheets-remove is deprecated now.
Comment #8
Jeff Burnz CreditAttribution: Jeff Burnz commentedAgree with #7 of course this is the right approach, however we need this to happen because right now this is a huge PITA and the only way is stylesheets-remove or some trickery in hook_css_alter().
Comment #9
Lukas von BlarerTo be precise this would happen in hook_library_info_alter(). Which is a clean solution. But we should introduce this functionality to the .libraries.yml as well.
Do we have to change the issue title and summary in this case?
Comment #10
star-szrJust to emphasize my point in #7, this is how you would in 8.0.x remove all CSS added by the system module (everything in system.libraries.yml):
mytheme.info.yml:
8 lines of code in an .info.yml file isn't so bad IMO. I'd like to know more about the use case for the wildcard approach because to me it could be much less predictable than library-based removal.
Edit: If you look at system.libraries.yml actually a bunch of those libraries are just JS, but the point still stands.
Comment #11
Lukas von BlarerWell my suggestion was kind of outdated I guess...
Ok, but stylesheet-remove does a quite different thing. In most cases I don't want to remove all JS the system module adds but all of it's CSS.
Besides that if you are using classy you can double this 8 lines yo will have to add all of those as well:
I guess this will get a lot worse installing contrib modules.
Is there a way to get rid of all CSS added by modules?
Comment #12
star-szrCheck out hook_css_alter and hook_library_info_alter :)