Skip to main content


Creating a new project

We recommend using create-leafjs-app (or cla for short) for newly created projects. CLA will automatically handle the development server and build process by interacting with Rollup JavaScript API.

However, using other bundlers such as Webpack may be possible - but with no offical support.

Simply run:

yarn create leafjs-app my-app

To create a new app named my-app. Then cd my-app to go into the app directory and install the dependencies using either Yarn or NPM. Finally, run:

yarn dev

To start a hot reloading development server.

Other commands such as build, start are also available.

Adding Leaf to an existing project

To manually add Leafjs to an existing project, install the required packages:

yarn add @leaf-web/core @leaf-web/parser

Then in your package.json, add the following scripts:

"scripts": {
"build": "leaf build",
"dev": "leaf dev",
"start": "leaf start"

Where build is used to build production-ready bundles and dev to start a hot-reloading development server. The start command is to serve the bundle produced by build. However, the start command should only be used for testing purposes - it contains no optimization!