css - 自定义主题不会在 Drupal 8 中加载主题 css 文件

标签 css drupal yaml drupal-8 drupal-theming

我正在制作一个新主题,但在加载 CSS 时遇到问题。虽然我认为它对 Drupal 文档是正确的,但它不起作用。

我在/themes/custom/noadin 中创建了一个文件夹并添加了信息和库文件

noadin.info.yml :

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

并创建了一个 noadin.libraries.yml :

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

样式表放在/themes/custom/noadin/css

谁能告诉我我误解了什么?

附注Drupal 采用了正确的主题。

最佳答案

您的 info.yml 和 libraries.yml 看起来不错,我认为可能是因为缓存,它没有加载 css 和 js 文件,请在清除缓存后尝试。 (登录到您的管理区域配置->开发->性能->清除所有缓存)之后尝试

您可以尝试查看这个工作示例 (http://wiki.workassis.com/drupal-8-custom-theme-from-scratch/),这对我有帮助。

关于css - 自定义主题不会在 Drupal 8 中加载主题 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35018212/

相关文章:

go - Viper 在解码时不考虑我的结构中的 yaml 标签

yaml - Conda 环境导出到 yaml 文件失败

css - 设置三级无序列表的样式

javascript - 滚动到页面底部时更改背景位置

php - 在 Drupal 中使用 "global"用户是否危险?

javascript - 如何动态调整 iFrame 的大小(跨浏览器解决方案)

javascript - jQuery UI 待办事项列表不起作用,需要一些指导

css - codepen 禁用外部图像链接

git - 如何使 Drupal 与 GitHub 存储库保持同步?

html - 检查变量是否为 liquid 中的字符串或数组类型