Problem/Motivation
The path logic is painful when using sub themes to overwriting libraries.
Lets say we have 2 themes : base and subtheme
If I want to remove the toolbar.theme.css in my basetheme (base) and i set my active theme set to "subtheme"
name: base
type: theme
base theme: classy
libraries-override:
toolbar/toolbar:
css:
theme:
css/toolbar.theme.css: false
subtheme:
name: subtheme
type: theme
base theme: base
core: '8.x'
Oki so that works fine toolbar.theme.css is removed when i use my subtheme, and it "inherits" the removing of toolbar.theme.css
But if I wanna do the same with a the theme that do not uses a subtheme i have to change the paths
name: basedrop
type: theme
base theme: stable # or classy
core: '8.x'
libraries-override:
toolbar/toolbar:
css:
theme:
/core/themes/stable/css/toolbar/toolbar.theme.css: false
The path for toolbar.theme.css have to be set to now to /core/themes/stable/css/toolbar/toolbar.theme.css instead of css/toolbar.theme.css: false thats kinda confusing
Proposed resolution
make paths for overwriting core allways be the same path
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
mortendk commentedComment #3
mortendk commentedComment #4
vdanielpop commentedHow do you think this should work? The specified file should be taken into consideration only when a file with the same path doesn't exist in the current theme's directory?
That doesn't feel quite right.
Comment #5
almaudoh commentedThere's a new patch over at #2642122: Overriding already overridden libraries-override requires knowledge of previous libraries-overrides that fixes this bug now and needs reviews and testing.
I think the signature of a libraries-override should remain the same for specific library, irrespective of the thememail in which it is declared.
The reason why it is different for stable is that stable overrides almost all the libraries, while classy doesn't.
Comment #7
chi commentedDoes it? I could not get it working on seven subtheme.
Comment #11
almaudoh commentedPatch at https://www.drupal.org/project/drupal/issues/2642122#comment-13240019 that fixes this needs reviews.
Comment #14
djsagar commentedHi @mortendk
Try this, this is the right example which you are looking for
Please let me know it's solve your problem or not.
Comment #19
smustgrave commentedIf #14 solves the issue.
Comment #21
quietone commentedThere are at least two comments, #5 and #11, that state that this problem is fixed in #2642122: Overriding already overridden libraries-override requires knowledge of previous libraries-overrides. And the has been no response to confirm if the suggestion in #14 fixes this, despite asking again 2 years ago.
Therefore I am closing this as a duplicate of that one.