gemini-ui-redesign / README (5).md
oldmonk69's picture
Upload 5 files
1517f5f verified
|
raw
history blame
2.47 kB

Hugging Face Space — Staticize Kit

This kit converts a PHP-based Space into a static Space (HTML/CSS/JS), ready to upload.

What this does

  • Converts every *.html into *.html (same relative paths)
  • Strips PHP code blocks <?php ... ?>
  • Rewrites internal links from .html.html across HTML/CSS/JS/MD
  • Ensures an index.html exists at repo root
  • Provides a tiny JS include system to replace PHP includes

Quick start

  1. Clone your Space locally

    git clone https://huggingface.co/spaces/oldmonk69/gemini-ui-redesign
    cd gemini-ui-redesign
    git checkout -b staticize
    
  2. Download and unpack this kit into the repo root

    • Place the contents of this folder into the repo root (you should see convert.sh at the same level as your existing files).
  3. Run the converter

    bash convert.sh
    
  4. Verify locally

    • Open the generated .html files in a browser (use a simple local server to avoid CORS issues):
      python3 -m http.server 5173
      # then visit http://localhost:5173/
      
  5. Commit and push

    git add -A
    git commit -m "Staticize Space: convert PHP to HTML, update links"
    git push -u origin staticize
    
  6. Switch Space runtime to Static (if not already)

    • In your Space: Settings → Runtime → Static
    • Ensure the repo root has index.html
  7. Restart Space to rebuild.

Includes-based layout (optional)

This kit ships asset/include.js and two partials:

  • asset/partials/header.html
  • asset/partials/footer.html

To use them in your pages:

<script src="/asset/include.js" defer></script>
<div id="site-header"></div>
<!-- page-specific content -->
<div id="site-footer"></div>

Edit the partials once and every page will pick them up at runtime.

Notes & caveats

  • If your PHP echoed dynamic HTML (templating), that content won’t exist after stripping. Copy the intended HTML into the new .html files manually (the script keeps a _backup_php/ folder for reference).
  • If you used server-side logic (forms, mailers, DB), you must replace it with client-side logic or move to a Docker Space running PHP.
  • Relative paths: when in doubt, use root-relative paths like /asset/... so links behave on every page.

Rollback

Everything original is backed up under _backup_php/. To undo, just reset your branch:

git reset --hard HEAD~1
git clean -fd