MetaBake CLI
MetaBake (mbake) CLI is an open-source, extensible low-code productivity bundler and builder designed for creating static websites and web applications, leveraging Pug and JAMstack principles. As of version 8.5.4, it provides out-of-the-box features like Pug compilation, livereload, Sass/SCSS compilation with autoprefixing, and TypeScript compilation. Its core differentiator is simplifying web development by abstracting away complex build configurations, allowing developers to write cleaner code quicker for various projects including static sites, custom elements, CMS, e-commerce, and CRUD applications. It facilitates a gradual adoption approach, enabling rapid development with a focus on simplicity and efficiency. While it doesn't specify a strict release cadence, it indicates active development. The tool focuses on generating static content that can be served efficiently via CDNs, using standard web technologies like HTML, CSS, and JavaScript, making it accessible to a broad audience.
Common errors
-
'mbake' command not found
cause The mbake package was not installed globally, or its installation path is not in the system's PATH.fixRun `npm i -g mbake` to install the package globally. If already installed, verify your system's PATH environment variable. -
Error: Node.js version X.Y.Z is not supported.
cause The currently active Node.js version is below the minimum requirement (>=14.0.0) specified by mbake.fixUpdate your Node.js to version 14.0.0 or newer. For example, using nvm: `nvm install 16 && nvm use 16`. -
Pug compilation failed: No such file or directory, 'index.pug'
cause The `mbake` command was executed in a directory that does not contain an `index.pug` file, or the path specified to `mbake` was incorrect.fixEnsure you are running `mbake` from the root directory of your project, where `index.pug` and `dat.yaml` are located, or specify the correct path, e.g., `mbake -w ./my-site`.
Warnings
- gotcha MetaBake requires Node.js version 14.0.0 or higher. Using an older Node.js version may lead to installation failures or unexpected runtime errors.
- gotcha For basic site compilation, `mbake` expects `index.pug` and `dat.yaml` files to be present in the root of the target directory. Missing these files will result in no output HTML.
- gotcha mbake is designed as a global CLI tool. Attempting to use it as a local `npm run` script without global installation or with an incorrect path may fail.
Install
-
npm install mbake -
yarn add mbake -
pnpm add mbake
Imports
- mbake (Global CLI)
import { mbake } from 'mbake'npm i -g mbake
- Watcher with Livereload
mbake --watch
mbake -w .
- Sass Compilation
mbake --sass
mbake -s .
- TypeScript Compilation
mbake --typescript
mbake -t .
Quickstart
npm i -g mbake
cd my-website-folder
# Create index.pug and dat.yaml files here
# Example index.pug:
/* header
body
p Hello #{key1} */
# Example dat.yaml:
/* key1: World */
mbake -w . # Starts watcher, livereload, and local server