Skip to content

pantoken-root / platforms/drupal/src / toDrupalTheme

ฟังก์ชัน: toDrupalTheme() ​

toDrupalTheme(options?): DrupalFile[]

ทดลอง

สร้างไฟล์สำหรับซับธีมของ Drupal ที่โหลด Instructure tokens.

พารามิเตอร์ ​

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