Just push to Github: Build static pages continuously using PHP generators like Jigsaw on Netlify

Install Jigsaw locally.

As I have had problems installing Jigsaw globally, I always install it locally

  • $mkdir jigsaw-netlify-test
  • cd jigsaw-netlify-test
  • composer require tightenco/jigsaw
  • ./vendor/bin/jigsaw init

Set up Git

  • Put your project folder in a git repo via git init
  • Create a repo in Github/Bitbucket/Gitlab and add remote repo locally
  • Create your first commit: git commit -am “Initial commit and push it to Github: git push

Set up Netlify page

  • Log into your Netlify account and create New site from Git
  • Select the repo that you just generated

Create deployment script

Netlify needs to know how to build your site. You can tell it by creating a netlify.toml config file:

Deploy

Try it out:

  • Make some changes in your local Jigsaw page in the /source folder.
  • Commit your changes
  • Push them to your Git repo
  • Select the site in Netlify and head over to Deploys where you can see your site building
  • The build script will automatically install all composer requirements and build your site
  • After about 4 minutes the build finishes and your site is live

Speed it up

  • I found out that yarn takes about 2 minutes to install itself and all dependencies in Netlify’s image
  • As I often do not need to recompile assets (from Sass or JavaScript bundles), but just change content in my Jigsaw site, I removed the package.json and use jigsaw instead of gulp
  • This speeds up the whole build process to only 15 secs (down from 4 minutes)
  • This is how my netlify.toml looks like

Unlisted

--

--

--

martinbetz.eu, Product owner, programmer, AB tester — Berlin/Germany

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Martin Betz

Martin Betz

martinbetz.eu, Product owner, programmer, AB tester — Berlin/Germany