You can create a Zess project using the @zessjs/cli
cli:
Here, my-app
is the name of the project directory to be created. After running the command, simply follow the prompts to enter the project name and select a template to quickly create a Zess project.
The newly created Zess project comes pre-configured with a complete development toolchain, including a routing system, the Vitest testing framework, as well as Tailwind CSS, ESLint, and Prettier, making it ready-to-use out of the box. Its detailed file structure is as follows:
First, you can choose an existing project directory, or initialize a new project using the following command:
Next, install the Zess core library using npm, pnpm, yarn, or bun:
Then install the Zess JSX compiler plugin (if Vite is not installed, please install it as well):
Add the following scripts to your package.json
:
Import @zessjs/vite-plugin
in your Vite configuration:
Also, create a new tsconfig.json
with the following content:
Run the following command to start the development server:
This command will start the Vite development server, which runs by default on http://localhost:5173
. You can visit this address in your browser to see the project in action.
When running the dev
command, you can specify the port or host using the --port
or --host
parameters, for example: npm run dev -- --port 8080 --host 0.0.0.0
.
Run the following command to build the project for production:
By default, the build output will be located in the dist
directory.
Run the following command to start a local preview server:
This command will start a local server to preview the built project.