@pantoken/drupal
v0.3.0
Published
Emit an Instructure-themed Drupal sub-theme: token CSS plus *.info.yml and *.libraries.yml.
Readme
@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>/.
Compatibility
Verified with the official Drupal 10.6.18 and 11.3.2 images. Drupal core's ExtensionDiscovery
discovers the generated theme, InfoParser accepts its .info.yml, and Symfony YAML validates the
library definition and referenced CSS assets. This does not install a full Drupal site. See the
compatibility matrix for exact core versions.
Install
npm i @pantoken/drupalAlso 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/instructureOutput
<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
