Host Jigsaw static content on Netlify

Jigsaw is a very lean static page generator and especially easy to learn for everyone familiar with Laravel and its blade templating language.

netlify is a fantastic host for static pages with a generous free tier and nice tooling.

One of the coolest features is Continuous Deployment: You create and preview your site locally, commit changes to your Git repo — and Netlify builds static pages using their build image.

Node, Ruby and Python based tools have been well supported for a long time, but PHP just got first class support lately: Netlify’s Bryce Kahle updated PHP to version 7.2, improved composer support and made sure that essential extensions like mbstring are in the base image.

Thanks to these changes, it is now super easy to have a continuous Jigsaw (PHP) build that reacts to commits to your Github, Gitlab or Bitbucket repos.

Let me walk you through an example site (see: minthemiddle/jigsaw-netlify-test):

Install Jigsaw locally.

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

Set up Git

Set up Netlify page

Create deployment script

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

[build]
PHP_VERSION=7.2
command = "gulp --production"
publish = "build_production"

This will use PHP7.2, run gulp which will compile assets and build your site using Jigsaw and deploy the static page to the /build_production folder from where Netlify publishes it to the web.

Deploy

Try it out:

Speed it up

# netlify.toml
[build]

PHP_VERSION=7.2

command = "./vendor/bin/jigsaw build production"
publish = "build_production"
Send me your feedback on
"Host Jigsaw static content on Netlify"

February 22, 2018 • Last updated: January 12, 2019

tech