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

  - mytheme/global-styling

  system/base: false

  header: Header
  content: Content  # the content region is required
  menu_primary: 'Menu - Primary'
  menu_secondary: 'Menu - Secondary'
  footer: Footer

Here's mytheme.libraries.yml

  version: 1.0
      css/global.css: {}

and this is the top of my html.html.twig file:

<!doctype html>
 <html lang="en">
   <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 }}

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?

  • Is the name of the theme mytheme or logis?
    – Kevin
    Commented Apr 27, 2016 at 14:05
  • mytheme, I corrected it.
    – Ondrej
    Commented Apr 27, 2016 at 14:06

1 Answer 1


Try this. I am using this in my base theme, and it works:

  version: VERSION
      css/YOURCSSFILE.css: {}
  • No difference. I also added an edit to the bottom of my description of the problem.
    – Ondrej
    Commented Apr 27, 2016 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.