my drupal custom theme doesn't load its css file

595 views Asked by At

i made a custom theme in drupal like this

my info.yml

name: Custom Theme
type: theme
description: 'Custom Theme for My Website.'
package: Other
core: 8.x
libraries:
- custom_theme/global-styling

base theme: classy

regions:
  header: Header
  primary_menu: 'Primary menu'
  secondary_menu: 'Secondary menu'
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  highlighted: Highlighted
  featured_top: 'Featured top'
  breadcrumb: Breadcrumb
  content: Content
  sidebar_first: 'Sidebar first'
  sidebar_second: 'Sidebar second'
  featured_bottom_first: 'Featured bottom first'
  featured_bottom_second: 'Featured bottom second'
  featured_bottom_third: 'Featured bottom third'
  footer_first: 'Footer first'
  footer_second: 'Footer second'
  footer_third: 'Footer third'
  footer_fourth: 'Footer fourth'
  footer_fifth: 'Footer fifth'

my libraries.yml

global-styling:
version: 1.x
 js:
js/script.js: {}
 css:
theme:
css/style.css: {}

but it uses stable theme css file instead of my custom theme css. any idea why?

i tried to clear the cashe and it wasn't the problem and i tried to override like this but im not sure if its correct and it didn't work either

libraries-override:
  block/drupal.block.admin.css:
     css:
      theme:
        stable/css/block/block.admin.css: false 
1

There are 1 answers

0
C.A. Vuyk On

Could be that your info.yml and libraries.yml doesn't have the right indentation. Should be something like

global-styling:
  version: VERSION
  css:
    base:
      css/style.css: {}
  

No tabs, use spaces.

core: 8.x
type: theme
base theme: classy

name: 'Custom Theme'
description: 'Custom Theme for My Website.'
libraries:
  - custom_theme/global-styling