docs: update MINIFICATION

2026-05-10 20:09:21 +00:00
parent 5888124bbf
commit 0ece2d5dec
+51 -22
@@ -8,10 +8,8 @@ CSS and JS assets are minified at build/release time. Minified files (`.min.css`
## Standard
All MokoStandards-compliant repos follow this pattern:
| What | Where |
|------|-------|
|---|---|
| Source files | Committed to git (`*.css`, `*.js`) |
| Minified files | Generated at build time, gitignored (`*.min.css`, `*.min.js`) |
| Release ZIPs | Include both source and minified versions |
@@ -20,16 +18,14 @@ All MokoStandards-compliant repos follow this pattern:
## Universal Minifier
**Location:** `moko-platform/build/minify.js`
Location: `moko-platform/build/minify.js`
Auto-discovers all CSS/JS files in a source directory, skipping `vendor/`, `node_modules/`, and already-minified files.
| File Type | Tool | Settings |
|-----------|------|----------|
| CSS | **clean-css** | Level 1 |
| JS | **Terser** | Compress + mangle |
### Usage
| Tool | Purpose |
|---|---|
| **clean-css** | CSS minification (level 1) |
| **Terser** | JS minification (compress + mangle) |
```bash
# From any repo root
@@ -64,7 +60,7 @@ The `build` target depends on `minify`, so `make build` and `make release` both
## CI/Release Integration
The `auto-release.yml` workflow includes Step 7.5 (Minify assets) which runs **before** the ZIP packaging step:
The `auto-release.yml` workflow includes Step 7.5 (Minify assets) before ZIP packaging:
```yaml
- name: "Step 7.5: Minify assets"
@@ -77,32 +73,65 @@ The `auto-release.yml` workflow includes Step 7.5 (Minify assets) which runs **b
[ -n "$MINIFY" ] && node "$MINIFY" src
```
This ensures minified assets are in the working tree when the ZIP is built, but never committed.
---
## MokoOnyx Runtime Minification
MokoOnyx includes `MokoMinifyHelper` which auto-minifies editable files on the server:
| Event | Behavior |
|---|---|
| **Debug OFF** | Regenerates `.min` files if source is newer than existing `.min` |
| **Debug ON** | Deletes all `.min` files so source is served directly |
| **Install/Update** | `cleanMediaFolder()` in `script.php` deletes stale `.min` files |
| **File edit** | Next page load detects stale `.min` and re-minifies |
### Files managed by MokoMinifyHelper
| CSS | JS |
|---|---|
| `css/template.css` | `js/template.js` |
| `css/offline.css` | `js/gtm.js` |
| `css/editor.css` | `js/user.js` |
| `css/a11y-high-contrast.css` | |
| `css/user.css` | |
| `css/theme/light.standard.css` | |
| `css/theme/dark.standard.css` | |
| `css/theme/light.custom.css` | |
| `css/theme/dark.custom.css` | |
Joomla's Web Asset Manager auto-serves `.min` files when debug mode is off -- no separate asset registration needed.
---
## .gitignore
All repos include:
All repos must include:
```
*.min.css
*.min.js
```
This is checked by the repo health check (`check_repo_health.php`).
---
## Repos with Minification Enabled
## Vendor Assets
- Template-Client-WaaS (client template)
- Template-Joomla (extension template)
- Template-MCP (MCP server template)
- MokoOnyx (Joomla template)
- client-clarksvillefurs
Vendor libraries (e.g. Font Awesome) ship pre-minified only. Unminified vendor source files are not included in the repo or release packages. The `cleanMediaFolder()` script removes any stale unminified vendor files on install/update.
---
## Related
- [WORKFLOW_STANDARDS](WORKFLOW_STANDARDS) -- CI/CD workflow conventions
- [ARCHITECTURE](ARCHITECTURE) -- Platform scripts architecture
- [WIKI_STANDARDS](WIKI_STANDARDS) -- repo file requirements
- [WORKFLOW_STANDARDS](WORKFLOW_STANDARDS) -- CI/CD conventions
---
*Repo: [moko-platform](https://git.mokoconsulting.tech/MokoConsulting/moko-platform) · [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home)*
| Revision | Date | Author | Description |
|---|---|---|---|
| 1.0 | 2026-05-09 | Moko Consulting | Initial minification standards |
| 2.0 | 2026-05-10 | Moko Consulting | Added MokoOnyx runtime minification, vendor policy, .gitignore requirement |