cssdrupalyamldrupal-8drupal-theming

Custom theme doesn't load theme css file in Drupal 8


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.


Solution

  • 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.