Accéder au contenu principal

Code Generation

Analog supports automated code generation using Nx Generators and Angular Schematics.

Generate a Page

This command generates a page inside our pages folder with minimal configuration out of the box.

Generators

The Analog plugin for Nx provides a series of generators that help automate some of the frequent tasks inside an Analog project, like generating a Page. To use these generators, the Nx Console extension can be installed or they can be invoked manually using:

npx nx generate @analogjs/platform:page --pathname=index --project=analog-app

it also works with the Analog specific filenames, Note: this names needs to be surrounded by single quotes ex:

npx nx generate @analogjs/platform:page --pathname='(blog)' --project=analog-app

The schematic as well accepts subfolders to structure our project properly.

npx nx generate @analogjs/platform:page --pathname='products/[products]' --project=analog-app