CLI commands

The CLI tool includes commands for scaffolding, developing, and building your emails.

Scaffolding

CLI commands for creating new projects and scaffolding templates or configs.

new

maizzle new [path?] [repo?] --no-deps?

The new command is used to scaffold and initialize a Maizzle project.

It accepts two arguments, both optional:

Argument Type Required Default Description
[path] string no maizzle Directory name to create project in
[repo] string no
https:‌//github.com/maizzle/maizzle.git
Git repository URL for a starter project
Flag Shorthand Description
--no-deps -d Don't install NPM dependencies

Running it with no arguments will:

  1. Create a maizzle directory
  2. Clone the maizzle/maizzle repo into it
  3. Install the NPM dependencies

So you can basically clone any repo into any system path, which means you can use any starter project - not just ours - as long as you can clone it with Git.

make:config

maizzle make:config <env> --full?

Scaffolds a new config.<env>.js in the project root.

Argument Required Default Description
<env> yes n/a Environment name to use for the config
Option Shorthand Description
--full -f Output a full config

The <env> argument is an environment name, i.e. staging.

For example, let's scaffold config.staging.js:

maizzle make:config staging

By default, a minimal config is output, which only defines build.destination.path:

module.exports = {
  build: {
    destination: {
      path: 'build_staging',
    },
  },
}

If you want a full config, use the --full option:

maizzle make:config staging --full

The full config is based on the Starter's config.js, with comments removed.

make:layout

maizzle make:layout <filename> --directory?

Scaffolds a new Layout based on the Starter's default Layout.

Argument Required Default Description
<filename> yes n/a Name of the file to create, including extension, i.e. layout.njk
Option Shorthand Description
--directory -d Directory where Layout file should be output

Examples:

# scaffold a Layout in src/layouts
maizzle make:layout my-layout.njk

# use a custom directory
maizzle make:layout amp-layout.njk --directory=src/layouts/amp

# the above is the same as
maizzle make:layout amp-layout.njk -d=src/layouts/amp

# paths can be relative to project root, i.e. one level above
maizzle make:layout master.njk -d=../global-layouts

make:template

maizzle make:template <filename> --directory?

Scaffolds a new Template.

Argument Required Default Description
<filename> yes n/a Name of the file to create, including extension, i.e. template.njk
Option Shorthand Description
--directory -d Directory where Template file should be output

Development

CLI commands for developing emails with Maizzle.

serve

maizzle serve

Use this command to develop emails locally.

A local development server is first created with BrowserSync, maizzle build is then called, and a directory listing is finally opened in your default browser (configurable).

You can make changes to a file, save it, and the browser will automatically reload to reflect changes. And, of course, you can also configure BrowserSync.

This command has the fastest build time, since most Transformers are disabled on purpose for local development, in the base config.js.

When developing locally, you have all classes generated by Tailwind CSS at your disposal, so you can rapidly prototype and style emails, even right in the browser.

build

maizzle build [env?]

maizzle build is used to compile your templates and output them to the destination directory. If [env] is specified, Maizzle will try to merge config.[env].js on top of the default config.

Argument Type Required Default Description
[env] string no local An environment name to use