Prismic CLI commands & options

The Prismic CLI is your gateway to work with Slice Machine. Using this tool allows you to set up your projects, manage your libraries, create new connected components and deploy new Slice models to your Prismic repo. So let's have a look at some of the commands you'll need to run to control that magic.

The CLI commands

You commands will follow this basic format

prismic sm <command> <options> 

Command List

Set-up

--setup installs dependencies and updates your project configuration to setup Slice Machine. You can read the full documentation here.

prismic sm --setup

Bootstrap

--bootstrap will Bootstrap a project with Slicemachine from an existing configuration.

prismic sm --bootstrap

Create Slice

--create-slice creates a new component template in the filesystem and in your Prismic custom types. You can read the full documentation for this process here.

prismic sm --create-slice

List Slices

--ls lists all the slices from libraries and the local files.

prismic sm --ls

Add a Storybook

--add-storybook creates a Storybook based on your Slice library to share with your team. You can read the full documentation for this process here.

prismic sm --add-storybook

Develop

This command will check if you are logged in to Prismic through the CLI, if not you will be prompted to do so, this is necessary to push your Slices to Prismic. Then it will run npm run slicemachine to launch The Slice Builder. In the future we will allow you to log in through The Slice Builder window.

prismic sm --develop

Options

No Prismic

--no-prismic skips the creation of a Prismic repository during the setup.

prismic sm --setup --no-prismic

Framework

Used to specify for which framework you want to --create-slice or --add-storybook.

prismic sm --create-slice --framework nuxt

Local Path

--local-path specifies a local folder that contains Slices during the setup.

prismic sm --setup --local-path ./slices

Specify Library

--library | --lib specifies which component library you want to use in your Nuxt Project.

prismic sm --setup --lib vue-essential-slices

Full Example

Setup an existing Nuxt.js project with Slice Machine using the library vue-essential-slices and specify the local path slices.

prismic sm --setup --lib vue-essential-slices --local-path ./slices
9 Rue de la Pierre Levée, 75011 Paris