Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

Fungsi: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

Eksperimental

Buat berkas untuk sub-theme Drupal yang memuat token Instructure.

Parameter

options?

ToDrupalThemeOptions = {}

ToDrupalThemeOptions.

Mengembalikan

DrupalFile[]

Berkas tema, jalur relatif terhadap direktori tema.

Contoh

Bangun dan tulis sub-theme mandiri

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

Bangun sub-theme di atas tema dasar

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

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