我的 drupal 自定义主题未加载其 css 文件

问题描述

我像这样在drupal中制作了一个自定义主题

我的信息.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'

我的库.yml

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

但它使用稳定的主题 css 文件而不是我的自定义主题 css。知道为什么吗?

我试图清除现金,这不是问题,我试图像这样覆盖,但我不确定它是否正确并且它也不起作用

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

解决方法

可能是您的 info.yml 和 libraries.yml 没有正确的缩进。应该是这样的

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

没有制表符,使用空格。

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...