slice-machine-ui - v0
Overview
slice-machine-ui
is the core package for Prismic’s local development tool, Slice Machine.
Dependencies and requirements
slice-machine-ui
version 0.7 works with Next.js and Nuxt 2. Version 1.0 will start adding support for more frameworks.
Installation
Slice Machine offers an init script to take care of most boilerplate and configuration.
init
script
In your project, run this command:
npx @slicemachine/init@^0.7
Manual install
To manually install Slice Machine, follow these steps:
-
Create a new Prismic repository from the Prismic dashboard.
-
In your project, add a
slicemachine
script to yourpackage.json
:
{
scripts: {
+ "slicemachine": "start-slicemachine"
}
}
- Create an
sm.json
file at the root of your project and paste in this information:
{
"apiEndpoint": "https://example-prismic-repo.cdn.prismic.io/api/v2",
"libraries": ["@/slices"],
"_latest": "0.7.0"
}
- Update the
apiEndpoint
property to your endpoint. Be sure to use the CDN and API v2.
Usage
Launch Slice Machine
slice-machine-ui
locally runs a development tool called Slice Machine. Run this command to launch Slice Machine:
npm run slicemachine
This will launch Slice Machine on localhost and show the URL in your terminal. Open the URL in your browser.
Configure sm.json
The sm.json
file contains an object that contains the following properties:
apiEndpoint Required | The endpoint for your repository. It should use the CDN ( |
libraries Required | An array of directories where Slice Machine can find slices, prefixed
with an |
_latest Required | The version of Slice Machine being used. |