Lume includes a simple script runner that you can use to execute commands or custom functions. To create a new script, use the function script() in your _config.js file:

site.script("deploy", "rsync -r _site/**");

Now, you can run this script from the CLI with lume run deploy.

Running multiple commands

You can create a script to execute multiple commands, one after other. There are two ways to do that: by adding more arguments or joining the different commands with &&. For example:

  "gzip -r _site site.gz",
  "scp site.gz",

// Alternative way using "&&"
  "gzip -r _site site.gz && scp site.gz",

Now, by running lume run save-site, these two commands will be executed.

If you don't need to execute the commands in serie but in parallel, use an array of commands or the character &:

    "gzip -r _site/images images.gz",
    "gzip -r _site/videos videos.gz",

// Alternative way using the character "&"
  "gzip -r _site/images images.gz & gzip -r _site/videos videos.gz",

Compose scripts

Scripts can execute other scripts, just use the name of a registered script as a command in another script. For example:

// Create two scripts
site.script("compress", "gzip -r _site site.gz");
site.script("upload", "scp site.gz");

// Create a third scripts that runs the two previous scripts
site.script("compress-and-upload", "compress", "upload");

Custom functions

Scripts not only can execute CLI commands but also JavaScript functions. For example:

site.script("add-date-published", () => {
    `Site published at: ${}`,

Running scripts from JavaScript

To run a script from JavaScript instead of the CLI, use the function:

// Create the script
site.script("compress", "gzip -r _site site.gz");

// Run it"compress");