RFC: Setup your slicemachine project with your custom library
See original GitHub issueContext
When using the command prismic sm --setup
the slice machine CLI will generate a new prismic repository and import in your project a set of default Open Source components.
For nuxt.js : https://github.com/prismicio/vue-essential-slices For next.js : https://github.com/prismicio/essential-slices
We had different request to be able to specify your own custom library instead of the default one
Solution
We will create a new argument for the prismic sm --setup command allowing you to specify your own custom library. (This should be a npm package)
prismic sm --setup --lib my-npm-package
This command will
Generate a new repository and configure your project to be linked to your newly created repository
As the current setup command, the command will create a new repository The CLI command will generate a new prismic repository & add the different files in your codebase to link your project to your prismic endpoint & setup the toolbar
Download your custom library as a dependency
- Add & download the dependency in your project
- Reference your library in the sm-resolver to use those slices automatically in the Slicezone.
Import your custom slices in your first created custom type.
- Generate a new prismic repository
- Create a page custom type
- Add all slices definition to your page custom type.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (11 by maintainers)
Top GitHub Comments
It would be nice not to have the essential slices installed by default, I don’t think it would have a steep learning curve. I find myself removing the essential-slice libraries as I don’t use them. (May be digging up an old thing here?)
All a new person would see is the magic that it opens up a page possibly and has some slices, unfortunately, it does push it all by default to the Prismic repository created and sometimes that isn’t wanted on say a new or old project. Because now I would need to go and clean those out.
If maybe setting up a template or new project, the tutorials or documentation can mention the use of the essential slices, and the code snippets have the flags there as Alex mentions.
Or during the starting process on setups with the CLI, the person could be presented with the option of one with the libs or without. But adding a description of what they are best for:
(Best for first time SM users)
and so forth.(Personally if there is a guided option or flag to opt-in to the essential libraries and some docs on updating the themes that would be great as that would make it possible for first time users to start a page, build and configure. Then if they have the confidence, they can just skip that and start a new fresh on without it to see.)
This could be super useful. I have some projects that don’t require the essential slices.