Spaces:
Running
Running
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
*.htmlinto*.html(same relative paths) - Strips PHP code blocks
<?php ... ?> - Rewrites internal links from
.html→.htmlacross HTML/CSS/JS/MD - Ensures an
index.htmlexists at repo root - Provides a tiny JS include system to replace PHP includes
Quick start
Clone your Space locally
git clone https://huggingface.co/spaces/oldmonk69/gemini-ui-redesign cd gemini-ui-redesign git checkout -b staticizeDownload and unpack this kit into the repo root
- Place the contents of this folder into the repo root (you should see
convert.shat the same level as your existing files).
- Place the contents of this folder into the repo root (you should see
Run the converter
bash convert.shVerify locally
- Open the generated
.htmlfiles in a browser (use a simple local server to avoid CORS issues):python3 -m http.server 5173 # then visit http://localhost:5173/
- Open the generated
Commit and push
git add -A git commit -m "Staticize Space: convert PHP to HTML, update links" git push -u origin staticizeSwitch Space runtime to Static (if not already)
- In your Space: Settings → Runtime → Static
- Ensure the repo root has index.html
Restart Space to rebuild.
Includes-based layout (optional)
This kit ships asset/include.js and two partials:
asset/partials/header.htmlasset/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
.htmlfiles 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