prismic-cli - v3
Introduction
A Node CLI for developing JavaScript apps with Prismic. Includes utilities for Slice Machine.
Dependencies and requirements
Runs on Node.js, and requires npm
or yarn
for installation.
Installation
Install globally via the command line:
npm install --global prismic-cli@3.8.4
Usage
Basic commands
| Display Prismic CLI help. |
| Create a new Prismic repository. |
| Create a new Prismic repository, download project files (GIT repository or ZIP file) from a URL, clone project, and add new repository URL to project config. |
| Create a Prismic account. |
| Log in to a Prismic account. |
| Log out of Prismic. |
Basic options
| Used with theme. Specify the configuration file. |
| Used with theme. Ignore the configuration file. |
Slice Machine commands
prismic sm | Display Prismic Slice Machine help. |
prismic sm --ls | List all the slices from libraries and the local files. |
prismic sm --setup | In the root folder of a supported framework (Nuxt and Next.js as of January, 2021), adds dependencies for Slice Machine and Slice Builder, creates a repository in Prismic, and adds Slice Machine configuration to project. |
prismic sm --boostrap | Bootstrap a project with Slice Machine from an existing configuration. |
prismic sm --create-slice | Create a new slice component in your file system and a corresponding slice in your Prismic repository. |
prismic sm --add-storybook | Create a Storybook at the root of your project and configure it to display your local slices. |
prismic sm --develop | Launch the Slice Builder locally. Storybook must already be running. |
prismic sm --pull | Pull slices from Prismic. |
Slice Machine options
--no-prismic | Used with —setup, skips the creation of a Prismic repository. |
--local-path | Used with —setup, specifies a local slice directory. |
--framework | Used with —create-slice or —add-storybook, specify the framework. Currently accepts next and nuxt. |
--library # or --lib | Used with —setup. Specify an external slice library to include. Uses vue-essential-slices by default. |
Examples
prismic new
# Create a project with a new prismic repository.
prismic theme https://github.com/prismicio/nodejs-sdk
# Create a project from a zip file with a new prismic repository.
prismic sm --setup
# Setup a nuxt.js project with Slice Machine.
prismic sm --setup --lib vue-essential-slices --local-path ./slices
# Setup an existing Nuxt project with Slice Machine.
prismic sm --ls
# List all the slices.
prismic sm --create-slice
# Setup a slice
prismic sm --pull
# Pull slices from Prismic