I just started using Drupal 8 and i am already experiencing problems. In my info.yml file I've added library/ies and in my libraries.yml are those files included. And when I clear cache in Admin, the css is not showing in source code. I've even clear cache in Drush, if that would be the problem but it's not.

Here is my libraries.yml file

version: 1.x
   css/style.min.css: {}

  js/app.min.js: {}
  - core/jquery

And here is my info.yml file:

name: MyTheme
description: MyTheme template for Drupal 8
type: theme
package: Custom
core: 8.x
screenshot: mytheme.jpg

 header: Header
 content: Content
 footer: Footer
 sidebar: 'Footer2'

What am I doing wrong?

  • Looks like there is missing indentation in your libraries file. – cilefen Dec 17 '15 at 14:34
  • Any idea how I can fix this ? – ZeroByte Dec 17 '15 at 14:35
  • Paste the YAML into yamllint.com or check the YAML syntax in your IDE of choice. For instance, when I paste the info.yml file, I see the line libraries: "-mytheme/globalstyling" which means that line is not interpreted as an array, which it needs to be so that is one problem. Additionally it would be best to use recommended 2-space indentation per Drupal coding standards so that your code is easier to read by community members. – mradcliffe Dec 17 '15 at 14:42
  • Check this tutorial – rpayanm Dec 17 '15 at 15:25

There is a space missing between the dash and the item:

  - mytheme/global-styling

And be careful with the indendation. Better use 2 spaces for each level. One space is difficult to see and if you miss one, the whole yaml-file will be invalid.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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