BlogTroubleshootingTroubleshooting

Palatian troubleshooting: build errors, icons or fonts not loading, scripts blocked, dark mode flashing

The usual causes behind a failed npm build, square boxes instead of icons, missing typefaces, a CDN script that never runs, charts that do not draw and a flash of light mode, with the fix for each.

3 min readPerforks

Square boxes instead of icons, and the stylesheet and fonts folder to check

npm install or npm run build fails

The build needs Node.js 20 or newer; check with node -v. Run the commands from the palatian-v1.5.0/ folder, where package.json is, and for the React edition from react/. If an install was interrupted, delete node_modules/ and run npm install again. npm run build is several steps in a row (vendor sync, theme bundle, charts bundle, calendar bundle, pages, post-build), so read the first error in the output, not the last.

The React edition's npm run generate reads dist/ of the HTML edition. If it complains about missing files, build the HTML edition first.

Icons show as empty squares

The icon stylesheets find their font files by a relative path: assets/css/palatian-icons.min.css expects the woff2 and woff files in assets/fonts/ next to it, and the same goes for tabler-icons.min.css. Keep assets/css/ and assets/fonts/ together when you move files. If you copied only the stylesheet somewhere else, edit the url(...) paths in its @font-face rules, as explained in using the icon font.

A single icon that does not appear is usually a name that does not exist: the class is palatian- plus the name, and the names are listed on the components page.

The typefaces are missing

Bricolage Grotesque, Instrument Sans and JetBrains Mono are loaded from Google Fonts by a <link> in the head of every page, so a page opened without an internet connection, or on a network that blocks Google Fonts, falls back to the system font. To self-host them, download the three families, put them in assets/fonts/ and replace the link in each page's head with your own @font-face rules. Fonts served from your own origin are allowed by the Content Security Policy as they are (font-src 'self'); fonts from any other origin need that origin added to font-src in vite.config.js.

A script from a CDN never runs

Every built page carries a <meta http-equiv="Content-Security-Policy"> that allows scripts only from the page's own origin, and the browser console reports the refusal. Add the CDN's origin to script-src in vite.config.js and rebuild, or build with PALATIAN_CSP=off to leave the tag out. The same policy blocks inline event handlers such as onclick; the template uses none, and your own code should listen with addEventListener or use the data-pl-* automations.

I edited the inline script in the head and now nothing works

The small script that restores the stored theme before the first paint is allowed by a hash in the policy. Change one character of it and the hash no longer matches, so the browser blocks it, and the page shows the default look. Put the snippet back exactly as it was, or edit it in src/partials/head.hbs and rebuild, which computes a new hash.

The page flashes light before turning dark

That snippet is also what prevents the flash: it reads palatian-theme and palatian-prefs from localStorage and sets the attributes on <html> before the stylesheet applies. If you have removed it, or moved it below the stylesheet, put it back in the head above the <link> to palatian.min.css. In the React edition the same snippet lives in react/index.html.

Charts do not draw

Charts live in their own bundle, assets/js/palatian-charts.min.js, which only the dashboard, analytics and chart pages load. On a page of your own, add that script after palatian.min.js. The calendar is the same with palatian-calendar.min.js. If you work in dist/ without the build, the global ApexCharts is not exposed; include ApexCharts on that page yourself and read colours with getComputedStyle(document.documentElement).getPropertyValue('--bs-primary').

Refreshing a React page gives a 404

Deep links in the React edition need the host to serve index.html for unknown paths, the usual single-page-app rewrite. The dev server does this by itself; a production host needs the rule.

A preference will not stick

Palatian.prefs.set() returns false for a value it does not know. The allowed values are in Palatian.prefs.options; a scheme of your own has to be added to PREF_OPTIONS in src/js/prefs.js, see changing the scheme. Preferences are per browser, in localStorage, so a private window starts from the defaults.