From c5192d9ece7c94321a18ba3e02a36bc66717be3a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 21 May 2024 08:56:59 -0300 Subject: url-spec: STATIC_VERSION 2a --- src/static/shared-util/README.md | 2 +- src/url-spec.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/static/shared-util/README.md b/src/static/shared-util/README.md index 92aa77e6..d21c0e6b 100644 --- a/src/static/shared-util/README.md +++ b/src/static/shared-util/README.md @@ -6,6 +6,6 @@ Module imports under `src/static/js` may appear to be pointing to files that are ...is reading a file that doesn't exist here, under `shared-util`. This isn't an error! -This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at `/shared-util/` online. +This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at (e.g.) `/static/shared-util/` online. The above import would actually import from the bindings in `src/util/sugar.js`. diff --git a/src/url-spec.js b/src/url-spec.js index 5bc34407..1f04a906 100644 --- a/src/url-spec.js +++ b/src/url-spec.js @@ -1,5 +1,11 @@ import {withEntries} from '#sugar'; +// Static files are all grouped under a `static-${STATIC_VERSION}` folder as +// part of a build. This is so that multiple builds of a wiki can coexist +// served from the same server / file system root: older builds' HTML files +// refer to earlier values of STATIC_VERSION, avoiding name collisions. +const STATIC_VERSION = '2a'; + const genericPaths = { root: '', path: '<>', @@ -67,17 +73,17 @@ const urlSpec = { }, staticCSS: { - prefix: 'static/css/', + prefix: `static-${STATIC_VERSION}/css/`, paths: genericPaths, }, staticJS: { - prefix: 'static/js/', + prefix: `static-${STATIC_VERSION}/js/`, paths: genericPaths, }, staticMisc: { - prefix: 'static/misc/', + prefix: `static-${STATIC_VERSION}/misc/`, paths: { ...genericPaths, icon: 'icons.svg#icon-<>', @@ -85,7 +91,7 @@ const urlSpec = { }, staticSharedUtil: { - prefix: 'static/shared-util/', + prefix: `static-${STATIC_VERSION}/shared-util/`, paths: genericPaths, }, -- cgit 1.3.0-6-gf8a5