My personal website, built as a custom static site generator.
- Templating: EJS (Embedded JavaScript) for HTML generation
- Styling: Node-Sass for CSS pre-processing
- Scripting: Browserify + Babel for JS bundling and transpilation
- Local Dev: Express + http-proxy-middleware for local serving
src/: Core source files including JS, Sass styles, and EJS templates.build/: The custom Node.js build system tools (bundlers, asset movers, page mappings).test/: Node.js native test scripts (build.test.mjs,golden.test.mjs).package/: The output directory for the optimized production build.golden/: The output directory for the unoptimized golden build (skips gzip/hashing).
- Install XCode command line tools:
xcode-select --install - Install homebrew. (see: brew.sh)
- Install homebrew dependencies:
brew bundle - Install node:
nvm install - Set node version:
nvm use - Install npm packages:
npm install
npm start: Build and launch the dev site at http://localhost:3000. (Stop the server withCtrl+C.)npm run scaffold --path=/my-page: Scaffolds boilerplate CSS, EJS, and JS files for a new page.npm run lint:src/npm run lint:build: Run ESLint on the source or build directories.npm run visual-diff: Runs the visual regression diffing script using Playwright/Puppeteer.
npm run build: Build the site for production into the/packagefolder, including file compression and gzip.npm run build:golden: Build the site into the/goldenfolder without gzip compression and asset hashing.
npm test: Runs the Node.js native test runner suite on the build processes.
My website uses AWS as the host, and the deploy uses the modular AWS SDK for JavaScript v3 (@aws-sdk/client-s3, @aws-sdk/lib-storage, @aws-sdk/client-cloudfront). For this to work you need credentials saved as bash variables:
CLOUDFRONT_IDAWS_ACCESS_KEYAWS_SECRET_ACCESS_KEYAWS_REGION(optional; defaults tous-east-1for S3—set this if your bucket lives in another region)
DO NOT SHARE YOUR CREDENTIALS WITH ANYONE. DO NOT COMMIT THEM TO A PUBLIC REPO.
npm run stage: Deploys the site to the staging S3 bucket.npm run deploy: Deploys the site to the production S3 bucket.