Licence
MIT
Version
0.1.1
Deps
2
Size
7 kB
Vulns
0
Weekly
0
@pantoken/drupal
Emit an Instructure-themed Drupal 10/11 sub-theme: the token stylesheet plus the *.info.yml and
*.libraries.yml a theme needs to load it. Drop the files into themes/custom/<machine>/.
Install
npm i @pantoken/drupal
Also available as pantoken/drupal.
Usage
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) {
/* write `path` under themes/custom/instructure/ */
}
Or via the CLI, straight into a theme directory:
pantoken generate drupal --out ./themes/custom/instructure
Output
<machine>.info.yml— the theme manifest (core_version_requirement: ^10 || ^11), attaching thetokenslibrary.<machine>.libraries.yml— atokenslibrary that loadscss/tokens.cssandcss/pantoken-prose.css.css/tokens.css— the@pantoken/csstoken stylesheet, defining the--instui-*custom properties your theme and modules consume.css/pantoken-prose.css— an InstUI-look stylesheet (from@pantoken/components) for rendered content in a.pantoken-proseregion (tables, headings, links, code).
<machine> is the display name lower-snake-cased (for example Instructure → instructure).
API
toDrupalTheme(options?): DrupalFile[]— build the sub-theme files.optionstakesname(display name, default"Instructure") andbaseTheme(defaultfalse).machineName(name): string— convert a display name to a Drupal machine name (lower_snake).DrupalFile— a generated file:path(theme-relative) andcontent.ToDrupalThemeOptions— the optionstoDrupalThemeaccepts.
Related
- Wraps
@pantoken/css(the token stylesheet) and@pantoken/components(the content look).
License
MIT