CSS and JS are not showing
Domanda
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
global-styling:
version: 1.x
css:
theme:
css/style.min.css: {}
global-js:
js:
js/app.min.js: {}
dependencies:
- 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
libraries:
-mytheme/global-styling
regions:
header: Header
content: Content
footer: Footer
sidebar: 'Footer2'
What am I doing wrong?
Soluzione
There is a space missing between the dash and the item:
libraries:
- 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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a drupal.stackexchange