Closed hypervillain closed 3 years ago
Looks awesome!
Can't we store the framework after initial setup in sm.json
? Looks annoying to use the framework flag every time you want to use the CLI...
Annoying indeed! We have an ongoing conversation regarding the flag on Slack, let me ping you there
You can store the framework in the sm.json
file. You would have to specify it when setting up the project:
prismic sm --setup --framework next
why not. I proposed to parse the package file and look for framework related dependencies (next, nuxt, gatsby..)
@lihbr this is solved by this now https://github.com/prismicio/slice-machine/issues/14
Setup a Storybook project
Run
prismic sm --add-storybook --framework [nuxt/next]
to setup a Storybook, configured to preview your local slices. It should install dependencies and add scripts to your package.json.Create a slice with its model and stories
Run
prismic sm --create-slice --framework [nuxt/next]
to create a slice folder. If no option is provided, the command would look for a template here. It should create:The template builder makes use of cpy-template-dir and passes
componentName
as var.Custom slice template
Pass the argument
--template-path relative-path-to-template
to provide your own template folder. You would need to at least create a validmodel.json
file, for the operation to succeed. If you don't want to pass a path each time you create a slice, the CLI will look for a folder namedslice-template
at the root of your project and use it if it's found.Preview of the command here: https://imgur.com/a/XTa04d6