How to remove a system CSS file in a Drupal 8 theme? - drupal

I am trying to remove Drupal CSS files (such as ajax-progress.module.css) from my custom theme YML. Here is what I tried:
name: Mercante
type: theme
description: Tema para o site Mercante.co
core: 8.x
stylesheets-remove:
- core/themes/stable/css/system/components/ajax-progress.module.css
libraries-override:
system/base:
css:
theme:
css/components/ajax-progress.module.css: false
Drupal's documentation about that is scarce at best...

With Drupal 8.5 you need a lot more. This removes everything:
libraries-override:
system/base: false
system/admin: false
system/maintenance: false
system/drupal.system: false
system/drupal.system.modules: false
system/diff: false
system/drupal.system.date: false
contextual/drupal.contextual-links: false
quickedit/quickedit: false
views/views.module: false
Obviously disabling modules you don't use like quickedit will help too, then you won't need to list them here.

This is for people who have 'stable' in the css path!
I was dealing with this long time but only this solution worked to me:
stylesheets-remove:
- '#stable/css/system/components/align.module.css'
But then I had to perform:
http://yourwebsite.local/core/rebuild.php
even when my cache is disabled everywhere using settings.local.php method as recommended.
I hope it will work for you as well.

Use libraries-override to remove the library associated with the all CSS components in mytheme.info.yml:
libraries-override:
system/base: false
Refer this link :
https://drupal.stackexchange.com/questions/178406/stylesheets-remove-in-info-yml-file-doesnt-work
https://drupal.stackexchange.com/questions/198315/removing-all-stable-themes-css-from-a-drupal-8-custom-theme

Your missing the leading slash /
stylesheets-remove:
- /core/themes/stable/css/system/components/ajax-progress.module.css

Related

How do you remove the academic and demos sections from the main page of the Academic hugo theme when using blogdown?

I created a site (https://www.dsobolew.me/) using blogdown and the Academic hugo theme. I want to remove the Academic and Demos sections on the main page so the first thing that appears is the Biography section. I see the markdown sections for each in the content/home folder. I expected to see a way to change the main page in the config.toml file but do not. How is this updated?
Duh. There is a setting in each md file within content/home that can be set = false.
Also for other people interested in that question:
They changed it in the meantime. Yes, the md files are under content/home but you have to add the option "active" now yourself (in an old version I used, the active option was already in the file).
So for example you take projects.md and just add the line:
active: false
In folder content you find the individual pages as .md. There set active: false.
For example you don't want content/home/hero.md
---
active: false
widget: hero
(...)
If you wish to remove to content/home/demo.md (by default says "Welcome to the demo of the academic resumé template for Wowchemy ..."), note line 7 by default there's already an active: true that needs to be removed or changed.
As of December 2022, I removed that by going into /content/_index.md and deleting the first "-block:" section

libraries-override not working on Drupal 8

I'm trying to figure out how I can remove the default css libraries of Drupal 8 on the theme I'm working on. I tried using libraries-override: to remove a specific CSS but it doesn't seem to be working. The css file is still showing. As you can see the align.module.css is still showing on Google Network Tab. I'm not sure if the method I'm using is deprecated or incorrect
name: Barebones
description: Drupal light
type: theme
core: 8.x
base theme: stable
libraries-override:
system/base:
css:
component:
/core/modules/system/css/components/align.module.css: false
Maybe help(not tested)
libraries-remove
The ability to remove entire libraries.
libraries-remove:
subtheme/library
core/modernizr
libraries-override
The ability to override entire libraries and parts of libraries:
libraries-override:
# Replace an entire library.
core/drupal.collapse: mytheme/collapse
# Replace an asset with another.
subtheme/library:
css:
theme:
css/layout.css: css/my-layout.css
# Remove an asset.
drupal/dialog:
css:
theme:
dialog.theme.css: false
# Remove an entire library.
core/modernizr: false

Custom theme doesn't load theme css file in Drupal 8

I'm making a new theme but have problems loading the css. Though I think it is correct to the documentation of Drupal it doesn't work.
I created a folder in /themes/custom/noadin and added the info and libraries files
noadin.info.yml :
name: noadin
description: 'My new theme'
type: theme
core: 8.x
libraries:
- noadin/global-styling
- noadin/global-scripts
and created a noadin.libraries.yml :
global-styling:
version: VERSION
css:
theme:
css/style.css: {}
global-scripts:
version: VERSION
js:
js/script.js: {}
The stylesheet is placed at /themes/custom/noadin/css
Can anyone tell me what it is that I am misunderstanding?
p.s. Drupal is taking the correct theme.
Your info.yml and libraries.yml looking fine, I think may be becouse of caching it is not loading the css and js file try after clearing the cache. (login to your admin area configuration->Development->Performance->Clear all caches) Try after this
You can try look in to this working sample (http://wiki.workassis.com/drupal-8-custom-theme-from-scratch/) this helped me.
Please make sure you have unchecked the following option from -
Home > Administration > Configuration > Development
Aggregate CSS files -- Uncheck and Save Configuration
#Koustav answer helped me a lot. I did changed the drupal/sites/default/files to proper owner since the "Bandwidth optimization menu was disabled and then went to
Home > Administration > Configuration > Development
and unchecked the Aggregate CSS files
Now it's working like a charm!
I was facing the same issue but resolved by doing the below steps.
Goto admin/config/development/performance
uncheck the Aggregate CSS files
uncheck Aggregate JavaScript files
Thanks!!!!!!!

Deactivating hashlinks rewrite in silverstripe 3.1

The old way of doing this is deprected. Is there a new way to do this? What are the pros and cons?
SSViewer:: dontRewriteHashlinks();
The requirement is because it breaks many JS plugins. Altering those standard UI components instead of making this change to SS seems the wrong way to fix this.
in /mysite/_config.php
Config::inst()->update('SSViewer', 'rewrite_hash_links', false);
or using the YAML config system (ex. /mysite/_config/config.yml)
SSViewer:
rewrite_hash_links: false
See http://doc.silverstripe.org/framework/en/3.1/reference/templates#fragment-link-rewriting

What is the purpose of compulsory sections?

I understand the benefit of required: false sections in MVC4. They are simply optional parts of a layout that will not display if the View does not contain them. But what is the benefit of required: true sections? Shouldn't something in a required: true section simply be put directly into the layout itself?
Just as an example, you could have a menu that would be required for each page but would also differ between controllers and/or areas.

Resources