A reusable portfolio website template built with Vite, TypeScript, and a styled animated background. The link in the repo is my site that is using this template.
- Install dependencies:
npm install- Run the development server:
npm run dev- Open the local URL shown in the terminal.
Edit index.html to replace placeholders with your own content:
Your Namein the header- hero title, description, and buttons
- about section text
- education section details
- skills chips
- experience timeline entries
- project cards and links
- contact URLs and email address
npm run buildThe output will be generated into the docs/ folder.
This repository is configured to deploy automatically to GitHub Pages from the built docs/ folder.
The workflow at .github/workflows/deploy.yml builds the site and deploys the generated docs/ folder to GitHub Pages.
- Commit your changes and push them to the
mainbranch. - GitHub Actions runs the deploy workflow automatically.
- The workflow installs dependencies, runs
npm run build, uploads thedocs/output, and deploys it viaactions/deploy-pages@v5.
If you prefer to run the workflow manually, open the Actions tab in GitHub, select the Deploy to GitHub Pages workflow, and click Run workflow.
vite.config.tsusesbase: './'so the built site works correctly from thedocs/folder.- The workflow expects
docs/as the production output directory. - If you use a custom domain, keep or update the
CNAMEfile in the repository root. - Confirm GitHub Pages is set to use GitHub Actions deployment in your repository settings if it is not already configured.
- The site uses
vitefor local development and production builds. - Vite is chosen because it is fast to update and makes it easy to see live changes to your site while you work.
- The animated canvas background is powered by
src/main.tsandsrc/canvas.ts. - Keep the
base: './'Vite config so the site works in subdirectories or GitHub Pages.
This template uses @chenglou/pretext to calculate text layout and drawing details for the canvas-based header and background.
src/pretext-renderer.tswraps Pretext helpers likeprepare,prepareWithSegments,layout,layoutWithLines, andwalkLineRanges.- It caches prepared text and layout blocks so repeated measurements and drawing operations stay fast.
- The renderer provides methods such as
measureWidth,measureParagraphHeight,getBlock,drawBlock,drawHRule, anddrawVRule. - In
src/main.ts, thedrawHeading()function usesrenderer.getBlock()andrenderer.drawBlock()to layout the header title text and draw responsive horizontal rules that adjust with the canvas size. - In
src/background.ts, the background grid usesrenderer.measureWidth('M', this.font)to determine the character width for the animated glyph grid, keeping the columns evenly spaced. src/pretext-renderer.tsalso exposesclearCache()andsetLocale()so the text layout cache can be reset if the locale or text rendering settings change.