Running commands is done through the
chef program. You can type
and get the complete list of commands and options.
The most common commands are:
init: This is the command that creates a new website. All it does really is create a new directory with a
config.ymlfile in it. For more information, see the Website Structure page.
prepare: Creating and editing text files is easy enough, but it can be even easier if you have a command to name the file for you – especially for blog posts which often require today’s date in their name. The
preparecommand can create a variety of content, but
prepare postare the most common usage. More more information, see Creating Pages.
serve: Previewing your website locally as you work on it is made possible by PieCrust’s built-in web server. After running the
servecommand, your website will be reachable at
<F5>to refresh the page is all you need to see updated content as you edit it.
bake: Finally, the
bakecommand transforms all your content – pages, templates, layouts, assets – into a self-contained static website that you can upload to your public server.
chef accepts various global options that can be useful in advanced
--root <dir>lets you specify the root directory of a website in which to run the command. This means you don’t need to change the current working directory to that website, which can be necessary for scripting, for instance.
--pid-file <file>creates a PID file containing the PieCrust process ID for the next command.
Several global options relate to modifying the website configuration. This is useful if you want to override some of the configuration settings temporarily.
When you modify the configuration like this, PieCrust has to use a different cache, because any change in the configuration can translate into any change in the generated content. This means that you may notice some commands not re-using cached outputs from previous commands.
--config <name>lets you specify a configuration variant to apply before running the command. A configuration variant is a fragment of website config that lets you override what’s defined normally in
config.yml. For more information, see the website configuration page.
--config-set <name> <value>lets you override a specific configuration setting.
Several global options relate to logging:
--quietwill make PieCrust only print out very important messages or errors.
--debugdoes the opposite, making PieCrust print lots of debugging information, including stack traces when errors occur – which is useful for troubleshooting a problem.
--loglets you log to a file. The complementary
--log-debuglets you log debug information (like
--debug) but only to the log file, which reduces spam in the console.
--no-colorsuppresses colored output. This can be useful if you want to parse PieCrust’s output without having to deal with weird ANSI color codes.