Skip to content

pantoken / platforms/drupal/src / toDrupalTheme

Funzione: toDrupalTheme()

toDrupalTheme(options?): DrupalFile[]

Sperimentale

Genera i file per un sotto-tema Drupal che carica i token Instructure.

Parametri

options?

ToDrupalThemeOptions = {}

ToDrupalThemeOptions.

Restituisce

DrupalFile[]

I file del tema, percorsi relativi alla directory del tema.

Esempi

Genera e scrivi un sotto-tema autonomo

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

Crea un sotto-tema basato su un tema di base

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

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