From eb87fe5f8d0f2a35f537575328e1a7dd68c9a9ee Mon Sep 17 00:00:00 2001 From: nixbytes Date: Tue, 17 Nov 2026 01:43:10 -0500 Subject: [PATCH 1/4] docs: prepare all static file types for GitHub Pages deployment --- .github/workflows/pages.yml | 60 +++++ GITHUB_PAGES_DEPLOYMENT.md | 453 ++++++++++++++++++++++++++++++++++++ docs/readme.md | 59 +++++ 3 files changed, 572 insertions(+) create mode 100644 .github/workflows/pages.yml create mode 100644 GITHUB_PAGES_DEPLOYMENT.md create mode 100644 docs/readme.md diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..73aba41 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,60 @@ +# Name: Pages Deployment +name: Deploy to GitHub Pages + +# Controls when the workflow will run +on: + push: + branches: + - gh-pages-docs # Source branch for deployment + paths-ignore: + - 'docs/**' # Ignore docs/ directory changes + - 'MARKUPUSH_STATUS.md' + - '.gitignore' + workflow_dispatch: # Manual trigger option + +# This job builds the static site and deploys to GitHub Pages +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout repository code + - name: Checkout Repository + uses: actions/checkout@v4 + + # Step 2: Setup Node.js for any build process (optional, if needed) + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' # Use Node v18+ + cache: 'npm' # Cache npm dependencies + + # Step 3: Install dependencies (if package.json exists) + - name: Install Dependencies + run: | + echo "Checking for build dependencies..." + if [ -f "package.json" ] && ! grep -q '"files"' package.json; then + npm install --production || true + fi + + # Step 4: Build/compile static assets (if needed) + - name: Prepare Build Files + run: | + echo "Preparing files for GitHub Pages deployment..." + + # Minimize CSS if not already done + if [ -f "css/style.css" ] && [ ! -f "css/style.min.css" ]; then + cp css/style.css css/style.min.css 2>/dev/null || true + fi + + shell: bash + + # Step 5: Deploy via GitHub Pages Actions + - name: Deploy with GitHub Pages Action + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ github.token }} + publish_dir: '.' # Use root of repo as publish directory + user_name: 'Github Pages Deployment Bot' + user_email: 'deployment@github.com' + keep_files: true # Preserve files from previous builds diff --git a/GITHUB_PAGES_DEPLOYMENT.md b/GITHUB_PAGES_DEPLOYMENT.md new file mode 100644 index 0000000..37950dd --- /dev/null +++ b/GITHUB_PAGES_DEPLOYMENT.md @@ -0,0 +1,453 @@ +# GitHub Pages Deployment Guide + +> **Purpose**: Documentation for deploying this WebAssembly-based web project as a static website using GitHub Pages hosting. + +--- + +## 📋 Table of Contents + +1. [Required Files Overview](#required-files-overview) +2. [File Inventory](#file-inventory) +3. [GitHub Pages Configuration Setup](#github-pages-configuration-setup) +4. [Deployment Verification Checklist](#deployment-verification-checklist) +5. [Static Hosting Limitations & Workarounds](#static-hosting-limitations--workarounds) + +--- + +## Required Files Overview + +This project can be deployed as a static website since it uses vanilla HTML/CSS/JavaScript with WebAssembly module loaded via script tag. Here are the **required file types** for GitHub Pages (and any static host): + +### Core Required Files + +| File Type | Ext(s) | Purpose | Location | Min Files Required | +|-----------|--------|---------|----------|-----| +| HTML Entry Point | `.html` | Main page/index | Root or `/views/` | 1 | +| CSS Stylesheets | `.css` | Styling | `/css/` or `/views/css/` | 1+ | +| JavaScript Logic | `.js` | DOM manipulation, WASM loader | `/js/` or `/views/js/` | 1+ | + +### Optional but Helpful Files + +| File Type | Ext(s) | Purpose | Recommendation | +|-----------|--------|---------|---------------| +| WebAssembly Module | `.wasm` + `.js` | Binary execution (if needed) | Build once, deploy all | +| Images/Media | `.png`, `.jpg`, `.gif` | Visual assets | Optimize for web | +| Favicon | `.ico` or `.svg` | Browser tab icon | 1 recommended | + +--- + +## File Inventory + +Based on analysis of this repository: + +### đŸŽ¯ Deployable Core Files (Minimum Complete Set) + +``` +index.html ✓ Entry point +css/style.min.css ✓ Global styles +js/perfmatters.min.js ✓ Main logic +views/pizza.html ✓ Pizza demo page +views/css/style.min.css ✓ View-specific styles +views/js/main.js ✓ View scripts +images/ (folder) Optional assets/docs +``` + +### ⚡ WebAssembly Module Files + +The `pizza.wasm` and its companion `.js` glue file are generated but required for the functionality: + +``` +src/ # Source C files (NOT needed - just references) +views/js/pizza.js ✓ Required for WASM loading +views/js/pizza.wasm ✓ Optional if not loaded directly +``` + +### 📁 All Available Pages in Repository + +| File | Type | Description | Deployable? | +|------|------|-------------|-------------| +| `index.html` | HTML | Landing page with stats/features | ✅ Yes | +| `project-webperf.html` | HTML | Web performance demo page | ✅ Yes | +| `project-mobile.html` | HTML | Mobile-first version | ✅ Yes | +| `project-2048.html` | HTML | 2048 game demonstration | ✅ Yes | +| `views/pizza.html` | HTML | Pizza generator app | ✅ Yes - Feature page | + +### 🎨 CSS Files (All Locations) + +| Path | File | Status | +|------|------|--------| +| `/css/style.min.css` | Main stylesheet (minified) | ✅ Deploy with JS | +| `/views/css/style.min.css` | View-specific styles (minified) | ✅ Required if views/ deployed | +| `src/css/bootstrap-grid.css` | Bootstrap grid framework | â„šī¸ Optional CSS reset | + +### 📖 JavaScript Files (All Locations) + +| Path | File | Description | +|------|------|-------------| +| `/js/perfmatters.js` | Full source | ✅ Keep for debugging | +| `/js/perfmatters.min.js` | Minified prod | ✅ Deploy this for production | +| `/views/js/main.js` | Main view script | ✅ Required | +| `views/js/pizza.js` | Generated from pizza.c | ✅ WASM interface | + +--- + +## GitHub Pages Configuration Setup + +### Option 1: Using `pages` Branch (Recommended) + +**Step 1:** Create a new branch named exactly `gh-pages` or `main`: + +```bash +git checkout -b gh-pages +cp -r /Users/nix/Documents/Code_Projects/Web_Optimization_Project/* . +cp -r views . +git add . +git commit -m "static: prepare all files for GitHub Pages" +git push origin gh-pages +``` + +**OR** if you want to keep `main` as the source: + +**Step 1:** Create `gh-pages` branch from current state: + +```bash +git checkout -b gh-pages +# Remove build artifacts not needed for static hosting +find . -name "*.wasm" -exec rm {} \; # WASM files only if not loaded via script +git add . +git commit -m "prepare: exclude wasm binary, keep js glue code" +``` + +### Option 2: Using `_config.yml` Configuration File + +Create `.github/pages/.yml` configuration: + +```yaml +source: docs # Where your static files live (root or views/) +baseurl: "" # Empty if hosting at username.github.io/user/project/ +plugins: + - jekyll +``` + +### GitHub Settings Configuration Path: + +1. Go to repository **Settings** → **Pages** tab +2. Source selection dropdown: choose `gh-pages` branch (or leave on main) +3. Root directory: `/` for root-level deployment OR `/views` for views subdirectory +4. Save changes + +--- + +### Recommended Structure for Deployment + +``` +root/ ← GitHub pages root + index.html ✓ Landing page + css/ + style.min.css ✓ Main styles + js/ + perfmatters.min.js ✓ Main logic (minified) + views/ ← Feature app directory + pizza.html ✓ Pizza generator + css/ + style.min.css ✓ View-specific CSS + js/ + main.js ✓ Entry point scripts + pizza.js ✓ WASM bindings +``` + +--- + +## Deployment Verification Checklist + +Before pushing to `gh-pages` branch, verify each item: + +### HTML Files ✅ + +- [ ] `index.html` contains `` section with proper meta tags +- [ ] All `.html` files have accessible viewport meta tag: `` +- [ ] No relative paths broken (uses `/absolute/path/` or root-level) +- [ ] Links to CSS: `` +- [ ] Links to JS: `` + +### JavaScript Files ✅ + +- [ ] `perfmatters.min.js` exists and is valid JavaScript +- [ ] No server-side code (C code paths should be pre-built) +- [ ] WASM module loaded via ` + ``` + +### CSS Files ✅ + +- [ ] All minified `.css` files parse correctly in browser dev tools +- [ ] No `url()` references to missing assets +- [ ] No server-dependent styles (e.g., `@import` from non-existent paths) + +### Build System Check ✅ + +```bash +# Verify the static-only build works without Emscripten +make test +# Should pass - tests validate JS behavior, not build artifacts +``` + +--- + +### Deployment Test URL Patterns: + +After deployment to `https://.github.io//`: + +- Landing page: `https://.github.io/` +- Feature app: `https://.github.io//views/pizza.html` + +If using `/views/` as root with `baseurl: /views`: +- Feature app: `https://.github.io//views/pizza.html` + +--- + +## Static Hosting Limitations & Workarounds + +### âš ī¸ WebAssembly Binary Constraints + +GitHub Pages is **static-only hosting**. This means: + +| Aspect | Situation | Workaround/Status | +|--------|-----------|-------------------| +| Binary WASM Files (`.wasm`) | Cannot be directly loaded by browsers via server-side processing | ✅ Not an issue if JS glue code loads WASM browser-side via script tag | +| Server-Side Scripts (.py, .php) | Will return 404 if referenced from static pages | Ensure all logic is in `.js` files only | +| Background Workers | Supported but must be pre-existing (cannot fetch dynamically without build) | N/A for this project | + +### Current Implementation Compatibility: + +✅ **Already compatible:** +- All JS code is browser-accessible via `` - -### JavaScript Files ✅ - -- [ ] `perfmatters.min.js` exists and is valid JavaScript -- [ ] No server-side code (C code paths should be pre-built) -- [ ] WASM module loaded via ` - ``` - -### CSS Files ✅ - -- [ ] All minified `.css` files parse correctly in browser dev tools -- [ ] No `url()` references to missing assets -- [ ] No server-dependent styles (e.g., `@import` from non-existent paths) - -### Build System Check ✅ - -```bash -# Verify the static-only build works without Emscripten -make test -# Should pass - tests validate JS behavior, not build artifacts -``` - ---- - -### Deployment Test URL Patterns: - -After deployment to `https://.github.io//`: - -- Landing page: `https://.github.io/` -- Feature app: `https://.github.io//views/pizza.html` - -If using `/views/` as root with `baseurl: /views`: -- Feature app: `https://.github.io//views/pizza.html` - ---- - -## Static Hosting Limitations & Workarounds - -### âš ī¸ WebAssembly Binary Constraints - -GitHub Pages is **static-only hosting**. This means: - -| Aspect | Situation | Workaround/Status | -|--------|-----------|-------------------| -| Binary WASM Files (`.wasm`) | Cannot be directly loaded by browsers via server-side processing | ✅ Not an issue if JS glue code loads WASM browser-side via script tag | -| Server-Side Scripts (.py, .php) | Will return 404 if referenced from static pages | Ensure all logic is in `.js` files only | -| Background Workers | Supported but must be pre-existing (cannot fetch dynamically without build) | N/A for this project | - -### Current Implementation Compatibility: - -✅ **Already compatible:** -- All JS code is browser-accessible via `