Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

Hàm: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

Thử nghiệm

Xây dựng các tệp cho một sub-theme Drupal tải các token Instructure.

Tham số

options?

ToDrupalThemeOptions = {}

ToDrupalThemeOptions.

Trả về

DrupalFile[]

Các tệp theme, đường dẫn tương đối so với thư mục theme.

Các ví dụ

Xây dựng và ghi một sub-theme độc lập

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

Xây dựng một sub-theme dựa trên một theme cơ sở

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

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