Builds / Scripting
Use a shell script that runs before your build to extend the functionality of your sites. Use this to use tools like Gulp and webpack easily.
To run a prebuild script:
- Create a
_cloudcannon-prebuild.shfile at the root of your file structure
- Enter the commands you want to run before each site build.
The prebuild script runs in a Node.js environment, if you need to install any npm packages.
#!/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:
- Fetching API data
- Running build commands other than Jekyll
- Sending messages to your Slack channel