Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

函式: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

實驗性

建立用於載入 Instructure tokens 的 Drupal 子佈景主題檔案。

參數

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" });