Rename project from cmjs to cmkiss (AI)
Updates every in-repo mention: README.md title/prose/example paths, code comments in config-default.js and router.js, and the IndexedDB DB_NAME prefix in cache.js (cmjs-cache-v3 -> cmkiss-cache-v3). The DB_NAME change has the same effect as a schema-version bump -- every returning visitor's browser opens a fresh, empty cache under the new name and the old cmjs-cache-v3 database is left as orphaned storage. Harmless (cache.js degrades to live-fetch when the cache is empty), noted in a comment there rather than left as an unexplained side effect. Two things this commit does NOT cover, both outside this checkout: - The local directory itself (still /home/user/Projects/cmjs) -- renamed separately right after this commit. - The git hosting-side repo name/remote URL (git.astronomickaexpedice.cz, Astronomicka_Expedice/cmjs.git) -- requires server-side access this session doesn't have; needs a manual rename on the host plus a local `git remote set-url` update to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e8af56069
commit
16395fa7c5
4 files changed
+25
-18
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# cmjs — Minimal Client-Side CMS
|
||||
# cmkiss — Minimal Client-Side CMS
|
||||
|
||||
A minimal CMS where articles are Markdown files rendered in the browser. No build step, no database, no server-side code.
|
||||
|
||||
@@ -36,14 +36,14 @@ A minimal CMS where articles are Markdown files rendered in the browser. No buil
|
||||
|
||||
## Project structure
|
||||
|
||||
This whole repo *is* cmjs — clone it as-is into an existing site (or copy `css/`, `js/`,
|
||||
This whole repo *is* cmkiss — clone it as-is into an existing site (or copy `css/`, `js/`,
|
||||
`strings/`, `templates/`, and your own `articles/` into one) and embed it into a page there; see
|
||||
"Embedding in an existing page" below. `demo/` is a standalone demo/preview page, kept separate
|
||||
from the library — not something an embedding page needs to bring along.
|
||||
|
||||
```
|
||||
├── README.md
|
||||
├── demo/ # Standalone demo/preview page — not needed to embed cmjs elsewhere
|
||||
├── demo/ # Standalone demo/preview page — not needed to embed cmkiss elsewhere
|
||||
│ ├── index.html # Single-page shell
|
||||
│ └── css/
|
||||
│ ├── reset.css # CSS variables, dark mode, box-sizing reset, focus styles
|
||||
@@ -91,11 +91,11 @@ from the library — not something an embedding page needs to bring along.
|
||||
|
||||
`js/config-default.js` holds the shipped defaults (`BASE_URL`, `MARKED_URL`, `ARTICLES_URL`) and
|
||||
is tracked in git; every other module imports from it. It also loads an optional `js/config.js`
|
||||
— gitignored, not part of cmjs's own git history — to override any of them. **Nothing needs to
|
||||
— gitignored, not part of cmkiss's own git history — to override any of them. **Nothing needs to
|
||||
be created before first use**: if `js/config.js` doesn't exist, the shipped defaults apply as-is.
|
||||
|
||||
The split exists for using cmjs as a git submodule (or otherwise pulling in a newer version some
|
||||
other way): since `config.js` is gitignored, updating cmjs never touches it, so any override
|
||||
The split exists for using cmkiss as a git submodule (or otherwise pulling in a newer version some
|
||||
other way): since `config.js` is gitignored, updating cmkiss never touches it, so any override
|
||||
you've made survives. Only `config-default.js` gets updated.
|
||||
|
||||
To override a setting, create `js/config.js` and export just the constant(s) you want to change —
|
||||
@@ -275,7 +275,7 @@ translate it by editing that page directly (`demo/index.html` for this repo's ow
|
||||
|
||||
## Embedding in an existing page
|
||||
|
||||
To add cmjs to any HTML page, three things are needed: the CSS, the two mount-point `<div>`s, and the script.
|
||||
To add cmkiss to any HTML page, three things are needed: the CSS, the two mount-point `<div>`s, and the script.
|
||||
|
||||
### 1. CSS — in `<head>`
|
||||
|
||||
@@ -313,10 +313,10 @@ Place these wherever you want the CMS to appear. The router toggles `hidden` bet
|
||||
|
||||
`router.js` is the only script tag needed. It loads `marked.min.js` automatically at startup (path configured in `js/config.js`).
|
||||
|
||||
> **Subdirectory pages:** If the embedding page lives in a subdirectory (e.g. `/blog/index.html`) and cmjs isn't installed at the site root, a plain relative path like `css/...` will resolve against the *page's* directory, not wherever cmjs actually lives. Use a path (root-relative or otherwise) that correctly points at wherever you placed it, e.g. if cmjs lives at `/cmjs/` on your site:
|
||||
> **Subdirectory pages:** If the embedding page lives in a subdirectory (e.g. `/blog/index.html`) and cmkiss isn't installed at the site root, a plain relative path like `css/...` will resolve against the *page's* directory, not wherever cmkiss actually lives. Use a path (root-relative or otherwise) that correctly points at wherever you placed it, e.g. if cmkiss lives at `/cmkiss/` on your site:
|
||||
> ```html
|
||||
> <link rel="stylesheet" href="/cmjs/css/components/card.css">
|
||||
> <script type="module" src="/cmjs/js/router.js"></script>
|
||||
> <link rel="stylesheet" href="/cmkiss/css/components/card.css">
|
||||
> <script type="module" src="/cmkiss/js/router.js"></script>
|
||||
> ```
|
||||
> All internal fetches (articles, templates, marked.js) resolve relative to the module files via `import.meta.url` and work automatically — only the HTML tags need a path pointing at the right place.
|
||||
|
||||
@@ -392,7 +392,7 @@ Point nginx `root` at the repo root. The `autoindex` directive applies recursive
|
||||
server {
|
||||
listen 80;
|
||||
server_name example.com;
|
||||
root /var/www/cmjs;
|
||||
root /var/www/cmkiss;
|
||||
|
||||
# Serve the demo page
|
||||
location /demo/ {
|
||||
@@ -414,13 +414,13 @@ server {
|
||||
|
||||
### Pointing articles/ somewhere else
|
||||
|
||||
By default the crawler looks for articles at `articles/` next to the rest of cmjs (`ARTICLES_URL`,
|
||||
By default the crawler looks for articles at `articles/` next to the rest of cmkiss (`ARTICLES_URL`,
|
||||
computed as a sibling of the `js/` folder). Articles don't have to live there — override
|
||||
`ARTICLES_URL` in your local `js/config.js` (see "Local configuration" above) to point anywhere
|
||||
under the same origin (or a different one, CORS permitting).
|
||||
|
||||
Whatever it resolves to needs its own matching `location` block enabling the JSON (or HTML)
|
||||
autoindex — it doesn't have to be named `articles/` or nested under wherever cmjs itself lives:
|
||||
autoindex — it doesn't have to be named `articles/` or nested under wherever cmkiss itself lives:
|
||||
|
||||
```nginx
|
||||
location /blog-content/articles/ {
|
||||
@@ -433,7 +433,7 @@ location /blog-content/articles/ {
|
||||
### Compression
|
||||
|
||||
Markdown and directory-listing JSON are both plain text, so gzip shrinks them well — and since
|
||||
the browser decompresses transparently, this needs no changes on the cmjs side. nginx doesn't
|
||||
the browser decompresses transparently, this needs no changes on the cmkiss side. nginx doesn't
|
||||
know `.md` is text by default (it falls back to `application/octet-stream`, which `gzip_types`
|
||||
won't match), so map it explicitly and enable gzip for both content types:
|
||||
|
||||
|
||||
+8
-1
@@ -12,7 +12,14 @@
|
||||
// each file's mtime happens to change — which, on a "deploy and forget"
|
||||
// site, could be years.
|
||||
const CACHE_SCHEMA_VERSION = 3;
|
||||
const DB_NAME = `cmjs-cache-v${CACHE_SCHEMA_VERSION}`;
|
||||
// The `cmjs-` -> `cmkiss-` prefix change (project rename) already has the
|
||||
// same effect as a version bump would — every existing visitor's browser
|
||||
// opens a fresh, empty database under the new name, and the old
|
||||
// `cmjs-cache-v3` one is left behind as orphaned storage (harmless; this
|
||||
// module degrades to live-fetch behaviour whenever the cache is empty or
|
||||
// unavailable). Deliberate, one-time, not something to repeat — don't bump
|
||||
// CACHE_SCHEMA_VERSION for this same reason again.
|
||||
const DB_NAME = `cmkiss-cache-v${CACHE_SCHEMA_VERSION}`;
|
||||
const STORE_NAME = 'articleFiles';
|
||||
|
||||
let cacheAvailable = true;
|
||||
|
||||
@@ -35,7 +35,7 @@ export const MARKED_URL = overrides.MARKED_URL ?? DEFAULT_MARKED_URL;
|
||||
|
||||
// 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 — override it in config.js to point
|
||||
// live anywhere near the rest of cmkiss — override it in config.js to point
|
||||
// anywhere under the same origin, 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.
|
||||
|
||||
+2
-2
@@ -84,9 +84,9 @@ function init() {
|
||||
});
|
||||
|
||||
// Show a top-level error if dependencies fail to load (or a mount point
|
||||
// is missing). Scoped to cmjs's own mount points when at least one
|
||||
// is missing). Scoped to cmkiss's own mount points when at least one
|
||||
// exists, rather than replacing the whole page — this can run on a page
|
||||
// that embeds cmjs alongside plenty of its own content, which wiping
|
||||
// that embeds cmkiss alongside plenty of its own content, which wiping
|
||||
// document.body would destroy too. Falls back to the full-page replacement
|
||||
// only when neither mount point is present to show the message in.
|
||||
ready.catch(err => {
|
||||
|
||||
Reference in new issue
Block a user