How to delete custom slices using CLI (SliceMachine)?

Hello Community,

Is there a command to delete custom slices using the CLI? I ran prismic sm --help but did not see that as an option. Or is there a way to do this in the SliceMachine and/or Storybook UI?

Else, I think I managed to delete manually by deleting the slice folder + import from the slice/index.js — anything else I should consider?

Cheers,
Patrick

Hello Patrick,

Thanks for posting this question to us.

There is no command yet to delete a slice. You need to delete it manually by deleting the folder. I understand how important it is to delete a created slice, but Slice-machine is still in beta, and our team is working on it to improve its feature.

Let me know if you have further questions.

Priyanka

Hi Priyanka,

thanks for the fast response. I totally understand about things being in beta, thought I'd just double check. Will go manual till further notice :slight_smile:

Cheers,
Patrick

1 Like

Hi Priyanka,

I have few other questions regarding this issue. As described, I managed to delete a custom slice manually by deleting/updating the following files from my local folder:

  • deleted: .slicemachine/assets/slices/MySliceName/preview.png
  • deleted: slices/MySliceName/index.stories.js
  • deleted: slices/MySliceName/index.vue
  • deleted: slices/MySliceName/mocks.json
  • deleted: slices/MySliceName/model.json
  • deleted: slices/MySliceName/preview.png
  • updated: slices/index.js (removed 'export { default as MySliceName } from "./MySliceName";'

Since deleting these files, the slice is no longer visible in my StoryBook or SliceMachine UI (as expected). However, it still shows up inside of my editor in Prismic under shared slices (see screenshot). Is there another step I need to do to remove this from Prismic? (FYI: I did also try clearing the browser cache/opening in private mode (Chrome), but the result was the same).

On a similar note:

  • screenshots do not seem to update after the first push to Prismic (see screen)
  • it seems the same issues prevent me from renaming any custom slices, i.e., changes can be made locally. However they don't update in Prismic.

Let me know if you would prefer me to raise add'l issues for the two above-mentioned.

Hey Patrick,

This is all you need to do. But once the slices have pushed to the Prismic UI, they will always be available in the shared tab even though you have deleted them from the code. I'll discuss this with my dev team to include this in their future improvements and will let you know what they think.

Thanks,

Priyanka

3 Likes

Hello Patrick,

I have discussed this with the team and this is something planned for future improvements yes! Being able to fully delete a slice, renaming it.

There will be a custom-type API where you will be able to update, delete shared slices, and documentation will release soon. You can check the progress here.

Thanks,

Priyanka

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Hi Everyone,

The team has planned to work in the current sprint to enable deletions and updates etc.

Although I've discussed a workaround for the moment here:

I'm also dealing with the preview images not being updated over in this thread:

Let me know if you have any questions.

Thanks.

1 Like

We pushed the update, if you update to slice-machine-ui@latest, it should allow you to update the images.

Hey,

At the moment if I want to delete a slice, I need to go in my codebase and delete all files/mentions of the slice I want to delete. Having a button within the web dashboard will be great!

Hello @kris

Thanks for suggesting this to us.

Unfortunately, there's currently no button to delete it. But, you can achieve this with the Custom Type API.

This is something planned for a future improvement, yes! Being able to fully delete a slice, renaming it, etc.

Thanks,
Priyanka

Hello!

I'm new to Prismic, and did a bunch of playing around, and now I have some "garbage" slices in my "Slices Library".

How do I delete these?

Cheers,
-Justin

Hello @prismic16

Welcome to the Prismic community and thanks for trying the Slice Machine.

We already have discussed this before in this thread:

Let me know if you have any further questions related to it.

Thanks,
Priyanka

Hi everyone :wave:

Thanks for your valuable feedback concerning deleting custom slices using Slice Machine!

:slight_smile: I am reaching out to invite you to our usability testing sessions.

The product team at Prismic is working on Custom Types deletion.

We’d love to understand your use case and get your feedback on a few screens, in order to design this feature the best way possible for you.

:spiral_calendar: We are currently scheduling participants for these video feedback sessions.

If you’re interested, please book a slot to talk to us .

We will be kicking off our sessions next week. The session will be run through Google Meet and will take around 45 minutes to complete. As a thank you for your time, we'll provide you with an $35 USD gift card.

What to expect during the session:

  • We will show you a design prototype for Custom Type deletion.
  • You’ll share your screen with us and talk us through how you’d expect to use this feature.
  • We’ll also ask you some questions based on the prototype and your particular use case.

Let me know if you have any questions!

2 Likes

Hello @kris @prismic16

Slices and CT deletion are out. It's available with v0.7.0.

Thanks,
Priyanka