Setup
Files
The package's dist folder holds:
-
css/tokens.css: colors, type, spacing, and sizes -
css/base.css: reset, element defaults, and helper classes css/components.css: element components-
css/header-footer.css: the header, sidebar layout, and footer -
js/ui.js: component behavior; see the script reference -
img/wikiportraits-logo.svg: WikiPortraits logo
Classes start with wp- and custom properties with
--wp-.
Install
npm install --save-exact @wikiportraits/halide
To install without npm: clone the repository, run
node build.js, and copy the contents of
dist into your site's public
halide folder.
Serving
In an Express app:
const express = require('express');
const path = require('node:path');
const app = express();
app.use('/halide', express.static(path.join(__dirname, 'node_modules/@wikiportraits/halide/dist')));
app.listen(3000);
In a Node.js build script:
import { cp } from 'node:fs/promises';
await cp('node_modules/@wikiportraits/halide/dist', 'dist/halide', { recursive: true });
Page head
Link the four stylesheets in the order below, followed by your site's own stylesheet.<meta ...>
<link rel="stylesheet" href="/halide/css/tokens.css">
<link rel="stylesheet" href="/halide/css/base.css">
<link rel="stylesheet" href="/halide/css/components.css">
<link rel="stylesheet" href="/halide/css/header-footer.css">
<link rel="stylesheet" href="/css/site.css">
<script src="/halide/js/ui.js" defer></script>
...