3
votes

I'm making a new theme but have problems loading the css. Though I think it is correct to the documentation of Drupal it doesn't work.

I created a folder in /themes/custom/noadin and added the info and libraries files

noadin.info.yml :

name: noadin
description: 'My new theme'
type: theme
core: 8.x
libraries:
  - noadin/global-styling
  - noadin/global-scripts

and created a noadin.libraries.yml :

global-styling:
  version: VERSION
  css:
    theme:
       css/style.css: {}
global-scripts:
  version: VERSION
  js:
    js/script.js: {}

The stylesheet is placed at /themes/custom/noadin/css

Can anyone tell me what it is that I am misunderstanding?

p.s. Drupal is taking the correct theme.

3

3 Answers

4
votes

Your info.yml and libraries.yml looking fine, I think may be becouse of caching it is not loading the css and js file try after clearing the cache. (login to your admin area configuration->Development->Performance->Clear all caches) Try after this

You can try look in to this working sample (http://wiki.workassis.com/drupal-8-custom-theme-from-scratch/) this helped me.

1
votes

Please make sure you have unchecked the following option from - Home > Administration > Configuration > Development

Aggregate CSS files -- Uncheck and Save Configuration

0
votes

@Koustav answer helped me a lot. I did changed the drupal/sites/default/files to proper owner since the "Bandwidth optimization menu was disabled and then went to

Home > Administration > Configuration > Development

and unchecked the Aggregate CSS files

Now it's working like a charm!