Files
cmkiss/js/config-default.js
T
biosiasandClaude Sonnet 5 c4d39ea1ad Split config.js into config-default.js (tracked) + config.js (gitignored)
Lets cmjs be used as a git submodule (or updated by any other means)
without a local config override -- e.g. a custom ARTICLES_URL -- being
clobbered by the update. js/config-default.js now holds the shipped
defaults and is tracked; js/config.js is gitignored and re-exports
those defaults unless overridden, and is what every other module
actually imports from.

Since js/config.js no longer ships with the repo, added a required
one-time setup step (cp js/config-default.js js/config.js) -- new
"Local configuration" section in the README, cross-referenced from
"Running locally", "Embedding in an existing page", and "Pointing
articles/ somewhere else".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXSVPS3UmmASiiprPfcnUd
2026-09-12 16:47:02 +02:00

29 lines
1.7 KiB
JavaScript

// All paths are derived from this module's own location via import.meta.url,
// so they resolve correctly regardless of where the embedding HTML page lives.
//
// This file ships with cmjs and is tracked in git — don't edit it directly.
// Everything else imports from the sibling `config.js` instead (gitignored,
// not part of this repo's history), which re-exports these defaults as-is
// unless overridden. That split means your own overrides (e.g. a custom
// ARTICLES_URL) survive updating cmjs — as a git submodule or by any other
// means of pulling in a newer version — since a fresh copy of this file
// never touches your untracked config.js. See "Local configuration" in the
// README.
// Base URL of the repo root — strings/ and templates/ live here, one level
// up from this file (e.g. https://example.com/).
export const BASE_URL = new URL('../', import.meta.url).href;
// Path to the marked.js vendor script — lives in vendor/, a sibling of this
// file's own js/ directory, not alongside the app's own modules.
export const MARKED_URL = new URL('../vendor/marked.min.js', import.meta.url).href;
// Base URL of the articles/ folder. Defaults to a sibling of this file's own
// js/ directory (the repo root's own articles/), but articles don't have to
// live anywhere near the rest of cmjs — replace this line to point anywhere
// under the same origin (`new URL('/blog-content/articles/', location.origin).href`)
// or even a different one, CORS permitting. Whatever it resolves to must
// still be a directory nginx serves a JSON (or HTML) autoindex listing for
// — see "nginx configuration" in the README.
export const ARTICLES_URL = new URL('articles/', BASE_URL).href;