Most websites need more than just HTML pages, and chances are that you’ll be using a few more tools than just Tiberius. You may want to generate stylesheets using less or sass, for example. And when your website is ready for the world to see, those generated files will have to get to the correct place on your webserver.
Tiberius Hooks provide an easy way to execute these custom scripts and commands during builds.
- Tiberius reads the configuration file
- Project directory structure sanity check
- Load templates and content files
- Generate pages
- In case of publish: execute
Hooks are defined in the main
tiberius.cfg configuration file:
[[PreBuild]] Name = "A name that describes your hook, for logging" Command = "echo" Args = ["arg1", "arg2"] Silent = false Draft = false
Command parameters are required.
Draft set to true will only be run in draft mode. Remember that the built-in development server always forces Tiberius to run in draft.
If you need multiple hooks, simply repeat the block. Hooks of the same type will be run in the order they appear in the configuration file.
Scripts run as hooks have access to a few extra environment variables:
These contain the absolute path to important project directories.