Jaspr CLI
Create, serve and build projects using the Jaspr CLI.
Commands
Jaspr comes with a cli tool to create, serve and build your website.
jaspr create: Create a new Jaspr project.jaspr serve: Serve the project and automatically refresh when you make changes.jaspr build: Build the project according to the selected rendering mode.
Additionally, there are the following service commands available:
jaspr doctor: Show information about the environment and current project.jaspr clean: Delete thebuild/and.dart_tool/directories.jaspr analyze: Report Jaspr specific lint warnings and apply fixes.jaspr update: Update the Jaspr cli.
Creating a new Project
The easiest way to create a new project is to start the scaffolding system with:
jaspr create my_website
This will walk you through a series of options to configure your starter project to your needs.
Alternatively, you can select a pre-made template using the --template option, with the following templates being available:
docs: A template for documentation websites usingjaspr_content.
Development Server
You can start your Jaspr project in development mode using:
jaspr serve
This will spin up a development server that automatically watches your project files for changes and rebuild your project.
How your website is served depends on your selected Rendering Mode:
Jaspr will execute the server entrypoint of your project and start a HTTP server to server-side render your components. During development, all server-side rendering is done on-demand when opening a page in the browser. This is the same behavior as when using server mode.
Any client entrypoints are compiled to JavaScript and served by the development server, along with any HTML files or other assets from the web/ directory.
The kDebugMode constant will be true during development, which allows you to write code that behaves differently in development and production.
Only when building will Jaspr pre-render all pages into static .html files.
Building
When it's time to deploy your application, you can build it using the following command:
jaspr build
This will build the app inside the build/jaspr/ directory according to your selected Rendering Mode:
Jaspr will start the server entrypoint of your project and pre-render all pages into separate .html files.
The pre-rendered pages and all files from web/ are built to the build/jaspr/ directory, which you can deploy to any static hosting provider.
Learn more about generating static sites here.

