Production's Content-Security-Policy has no script-src, so it falls back to default-src 'self' and blocks inline scripts. The inline head script that applied the saved theme never ran on prod, leaving the page on the system theme while the selector showed the saved choice. Move it to resources/js/theme-init.js, built by esbuild alongside app.js into a minified, source-mapped file loaded as a blocking script in the head. ThemeSelector now also applies the saved colour scheme, so the page and buttons can't disagree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.4 KiB
JSON
38 lines
1.4 KiB
JSON
{
|
|
"private": true,
|
|
"name": "jbuk-frontend",
|
|
"version": "0.0.1",
|
|
"type": "module",
|
|
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
|
"license": "CC0-1.0",
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@stylistic/eslint-plugin": "^5.1.0",
|
|
"esbuild": "^0.28.1",
|
|
"eslint": "^10.0.1",
|
|
"globals": "^17.3.0",
|
|
"lightningcss": "^1.29.3",
|
|
"lightningcss-cli": "^1.29.3",
|
|
"stylelint": "^17.3.0",
|
|
"stylelint-config-standard": "^40.0.0"
|
|
},
|
|
"scripts": {
|
|
"eslint": "eslint resources/js/*.js",
|
|
"stylelint": "stylelint resources/css/*.css",
|
|
"lint": "npm run eslint && npm run stylelint",
|
|
"lightningcss": "lightningcss --output-dir public/assets/css --sourcemap --bundle --minify resources/css/app.css",
|
|
"fix-sourcemap": "./scripts/fix-sourcemap.sh",
|
|
"build-css": "npm run lightningcss && npm run fix-sourcemap",
|
|
"build-js": "esbuild resources/js/app.js resources/js/theme-init.js --bundle --minify --sourcemap --outdir=public/assets/js",
|
|
"compress": "./scripts/compress.sh",
|
|
"build": "npm run lint && npm run build-css && npm run build-js && npm run compress"
|
|
},
|
|
"dependencies": {
|
|
"@11ty/is-land": "^5.0.0",
|
|
"@zachleat/snow-fall": "^1.0.3"
|
|
},
|
|
"allowScripts": {
|
|
"esbuild@0.27.7": true,
|
|
"lightningcss-cli@1.32.0": true
|
|
}
|
|
}
|