Skip to content

Prebuild

On this page:

Loading...

Use a shell script that runs before your build to extend the functionality of your sites. Run tools like Gulp and Webpack before your build.

To run a prebuild script:

  1. Create a _cloudcannon-prebuild.sh file at the root of your file structure
  2. Enter the commands you want to run before each site build.
Note

The prebuild script runs in a Node.js environment, if you need to install any npm packages.

Here’s an example file that bundles JavaScript files using webpack:

_cloudcannon-prebuild.sh
#!/bin/sh

npm install webpack
npm install webpack-cli

./node_modules/.bin/webpack path/to/entry.js -o js/output.js

Prebuild commands allow you to incorporate your favourite tools for building and pre-processing into CloudCannon. Some ideas for using this feature include:

  • Bundling JavaScript
  • Fetching API data
  • Running build commands other than Jekyll
  • Sending messages to your Slack channel
On this page:

Loading...

Don’t miss the latest
CloudCannon news freshly delivered to your inbox