Custom theme doesn't load theme css file in Drupal 8
Asked Answered
V

4

5

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.

Vasoinhibitor answered 26/1, 2016 at 15:59 Comment(0)
A
6

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.

Accusation answered 13/6, 2016 at 12:50 Comment(2)
It'd be best if the accepted answer clarified specifically what is wrong because there are really two different answers hereLefthand
After trying so many things, clearing the cache was the answer, I'm new to Drupal and didn't know how to do that in the admin.Bellied
A
1

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

Aggregate CSS files -- Uncheck and Save Configuration

Angry answered 22/4, 2021 at 12:33 Comment(0)
D
0

@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!

Dwanadwane answered 10/8, 2021 at 16:39 Comment(0)
G
0

I was facing the same issue but resolved by doing the below steps.

  1. Goto admin/config/development/performance
  2. uncheck the Aggregate CSS files
  3. uncheck Aggregate JavaScript files

Thanks!!!!!!!

Gluck answered 11/4, 2022 at 11:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.