I'm creating a new D8 theme and am having trouble making Drupal load the CSS that is a part of my theme. I have disabled cache and am sure I'm getting the up-to-date output.
Here's my mytheme.info.yml:
name: Mytheme type: theme description: 'This is a description.' core: 8.x libraries: - mytheme/global-styling libraries-override: system/base: false regions: header: Header content: Content # the content region is required menu_primary: 'Menu - Primary' menu_secondary: 'Menu - Secondary' footer: Footer Here's mytheme.libraries.yml
global-styling: version: 1.0 css: theme: css/global.css: {} and this is the top of my html.html.twig file:
<!doctype html> <html lang="en"> <head> <title>{{ head_title }}</title> <head-placeholder token="{{ placeholder_token|raw }}"> <css-placeholder token="{{ placeholder_token|raw }}"> <js-placeholder token="{{ placeholder_token|raw }}"> {{ page.head }} {{ page.styles }} {{ page.scripts }} </head> ... The content in the YAML files is not tabbed, spaces are used.
I already spent several hours trying to figure out what's wrong and why the global.css is not being linked in the header of the html page, but I have no idea. I'll be gratefull for any help.
EDIT: I found out that my CSS do load when I use this:
{{ attach_library('mytheme/global-styling') }} but I thought the point of referring to global-styling inside mytheme.info.yml was that I don't have to do that. Did I understand that correctly?