BlogGetting startedHTML edition

How to run the Palatian HTML edition locally and build it with Vite

Open the built pages straight from the dist folder, or install Node.js 20 and run the Vite dev server when you want to edit the SCSS, the partials or the engine. The npm scripts and what each one does.

3 min readPerforks

The npm scripts of the HTML edition: install, the Vite dev server and the build into dist

There are two ways to work with the HTML edition. If you only want to edit the pages, you need nothing but a text editor. If you want to change the SCSS, reuse the page partials or extend the engine, you build with Vite. Both are quick.

Without a build step

  1. Unzip the download and open dist/index.html in a browser. The built pages are plain HTML and link one stylesheet and one script with relative paths, so they work straight from disk.
  2. To put the admin on a server, upload the dist/ folder as it is. server-config/apache.htaccess and server-config/nginx.conf carry the security headers and cache rules the pages expect.
  3. Edit the HTML files directly. Replace the demo text, the avatars in assets/img/avatars/ and the brand name in the dock and on the authentication pages.

The pages load the three typefaces from Google Fonts, so a page opened from disk needs an internet connection to show them; without one it falls back to the system font. Everything else is local.

With the build

The build needs Node.js 20 or newer. From the palatian-v1.5.0/ folder:

npm install
npm run dev      # Vite dev server with live reload at http://localhost:5173
npm run build    # writes the production files to dist/

In development you edit src/:

  • src/*.html are the pages, assembled from the Handlebars partials in src/partials/, so the dock, panel and toolbar live in one place.
  • src/scss/ holds the styles. _variables.scss has the Bootstrap overrides, _tokens.scss the surface and scheme custom properties, _prefs.scss the theme-settings options and _luxe.scss the depth and material layer.
  • src/js/ is the engine: layout, command bar, inspector, automations, forms, preferences, chart helpers, data table, and page initialisers in src/js/pages/.
  • public/ is copied into dist/ unchanged.

What npm run build does

The script runs several steps in a row: it syncs the vendor files, builds the theme bundle (vite.lib.config.js), the charts bundle (vite.charts.config.js) and the calendar bundle (vite.calendar.config.js), then the pages (vite.config.js), and finishes with a post-build step. The result is dist/ with palatian.min.css, its right-to-left twin generated by rtlcss, the three scripts, and a Content Security Policy meta tag on every page whose hash matches the small theme-restore snippet in the head.

The other scripts

CommandWhat it does
npm run previewServes the built dist/ folder locally.
npm testThe smoke test: opens every page in a browser and checks it (Playwright is a development dependency).
npm run iconsRebuilds the Palatian icon font from scripts/icons/build-icons.js: the SVGs, the four fonts, the CSS and the preview page.
npm run screenshotsTakes the preview screenshots of the pages.
npm run mapRegenerates the dashboard's world map partial.

Building without the Content Security Policy

Every built page carries a <meta http-equiv="Content-Security-Policy"> that allows scripts only from the site itself. If you add a script from a CDN, add its origin to script-src in vite.config.js; to leave the tag out altogether, build with the environment variable PALATIAN_CSP=off (the older name TESSERA_CSP=off still works). More in troubleshooting.

The React edition needs this build to have run once, because it copies the stylesheet, fonts and icons from dist/. See running the React edition.