# preact-cli **Repository Path**: mirrors_feross/preact-cli ## Basic Information - **Project Name**: preact-cli - **Description**: 😺 Your next Preact PWA starts in 30 seconds. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-05 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # preact-cli [![NPM Downloads](https://img.shields.io/npm/dm/preact-cli.svg)](https://www.npmjs.com/package/preact-cli) [![NPM Version](https://img.shields.io/npm/v/preact-cli.svg)](https://www.npmjs.com/package/preact-cli) > Start building a [Preact] Progressive Web App in seconds 🔥 ### Contents - [Features](#features) - [Usage](#usage) - [Official Templates](#official-templates) - [CLI Options](#cli-options) - [preact create](#preact-create) - [preact build](#preact-build) - [preact watch](#preact-watch) - [preact list](#preact-list) - [preact info](#preact-info) - [Deploying](#deploying) - [Pre-rendering](#pre-rendering) - [Custom Configuration](#custom-configuration) - [Plugins](#plugins) - [Browserslist](#browserslist) - [Babel](#babel) - [Webpack](#webpack) - [Prerender multiple routes](#prerender-multiple-routes) - [Template](#template) - [Using CSS preprocessors](#using-css-preprocessors) - [SASS](#sass) - [LESS](#less) ### Features - **100/100 Lighthouse score**, right out of the box ([proof]) - Fully **automatic code splitting** for routes _(see [Route-Based Code Splitting](#route-based-code-splitting))_ - Transparently code-split any component with an [`async!`] prefix - Auto-generated [Service Workers] for offline caching powered by [Workbox] - [PRPL] pattern support for efficient loading - Zero-configuration pre-rendering / server-side rendering hydration - Support for CSS Modules, LESS, Sass, Stylus; with Autoprefixer - Monitor your bundle/chunk sizes with built-in tracking - Automatic app mounting, debug helpers & Hot Module Replacement - In just **4.5kb** you get a productive environment: - [preact] - [preact-router] - 1.5kb of conditionally-loaded polyfills for [fetch] & [Promise] ### Requirements > **Important**: [Node.js](https://nodejs.org/en/) > V8.x and npm 5.2+ is a minimum requirement. ### Usage ```sh $ npx preact-cli create ``` Example: ```sh $ npx preact-cli create default my-project ``` The above command pulls the template from [preactjs-templates/default], prompts for some information, and generates the project at `./my-project/`. ### Official Templates The purpose of official preact project templates are to provide opinionated development tooling setups so that users can get started with actual app code as fast as possible. However, these templates are un-opinionated in terms of how you structure your app code and what libraries you use in addition to preact.js. All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `preact create ` to use that template. Current available templates include: - [default] - Default template with all features. - [material] - material template using preact-material-components - [simple] - The simplest possible preact setup in a single file - [netlify] - Netlify CMS template using preact. - [typescript] - Default template implemented in TypeScript - [widget] - Template for a widget to be embedded in another website. > 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`preact create / ` ### CLI Options #### preact create Create a project to quick start development. ``` $ preact create --name The application name. --cwd A directory to use instead of $PWD. --force Force option to create the directory for the new app [boolean] [default: false] --yarn Installs dependencies with yarn. [boolean] [default: false] --git Initialize version control using git. [boolean] [default: false] --install Installs dependencies. [boolean] [default: true] ``` Note: If you don't specify enough data to the `preact create` command, it will prompt the required questions. #### preact build Create a production build You can disable `default: true` flags by prefixing them with `--no-