Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

関数: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

実験的

Instructure トークンを読み込む 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" });