I am Nik Butler

Knowledge Knolling

Enabling local development with Wrangler

I my have mentioned that this site, and my Azydeco site, are powered by Cloudflare pages, Metalsmith, and Handlebars, When we leaned into an idea for simple hosting and content creation we ran with it and I have to say I am very happy with the outcomes. One of the tricks we have in our build process is to run both a watch and a preview feature whilst writing articles and saving work. You can read a more in depth view as to using Wrangler with your Cloudflare deploys on our article "using wrangler to develop cloudflare pages locally"; one addition im now making in my own hosting is to force https on outcomes to reduce the mixed content errors in console. I would ideally like to have a local https with a less whinging self signed cert notice in my browser but for now the following entries in my package.json allow me to run watch and preview commands.

"scripts": {
    "watch": "cross-env NODE_ENV=local WATCH_ENV=true node build.js",
    "preview": "wrangler pages dev .dist --port 3000   --live-reload --local-protocol=https .dist  --compatibility-date=2025-04-09",
  },

With those commands in place I can run up

pnpm run watch 

then

pnpm run preview

Whilst editing and saving work in my sites articles folders.