---
url: /api/platforms/drupal/src/functions/toDrupalTheme.md
---
[pantoken-root](../../../../index.md) / [platforms/drupal/src](../index.md) / toDrupalTheme

# Function: toDrupalTheme()

> **toDrupalTheme**(`options?`): [`DrupalFile`](../interfaces/DrupalFile.md)\[]

Experimental

Build the files for a Drupal sub-theme that loads the Instructure tokens.

## Parameters

### options?

[`ToDrupalThemeOptions`](../interfaces/ToDrupalThemeOptions.md) = `{}`

[ToDrupalThemeOptions](../interfaces/ToDrupalThemeOptions.md).

## Returns

[`DrupalFile`](../interfaces/DrupalFile.md)\[]

The theme files, paths relative to the theme directory.

## Examples

**Build and write a standalone sub-theme**

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

**Build a sub-theme on top of a base theme**

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

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