Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

函数: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

实验性

为 Drupal 子主题构建文件,使其加载 Instructure 令牌。

参数

options?

ToDrupalThemeOptions = {}

ToDrupalThemeOptions.

返回值

DrupalFile[]

主题文件,其路径相对于主题目录。

示例

构建并写出一个独立的子主题

ts
import { writeFileSync, mkdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { toDrupalTheme } from "@pantoken/drupal";

const files = toDrupalTheme({ name: "Instructure" });
// [ instructure.info.yml, instructure.libraries.yml, css/tokens.css, css/pantoken-prose.css ]
for (const { path, content } of files) {
  const dest = join("./themes/custom/instructure", path);
  mkdirSync(dirname(dest), { recursive: true });
  writeFileSync(dest, content);
}

在基础主题上构建子主题

ts
import { toDrupalTheme } from "@pantoken/drupal";

const files = toDrupalTheme({ name: "Instructure", baseTheme: "olivero" });