Is necessary commit .slicemachine folder?

Hey guys.

We're having a lot of questions using slicemachine. Currently, i dont know if is necessary i do commit the .slicemachine folder, because it creates a lot of void folders and mocks files without any data...

Is there some guide to help me about that? Do i need to commit .slicemachine folder to github?

Hi Team,

Yes, it's necessary to commit this folder. This folder contains the preview images for the Slices which are sent to Prismic, as well as the mock data that is necessary when working within development teams.

When you say 'void folders' what exactly do you mean?


Thank you Phil.

About "void folders" i said it because slice machine was creating some folders without content.

I have other question...

Should i put my components in .slicemachine folder? or is it only for mocks and storybook?

The project that i work was not started with slicemachine. So i have the components folder inside source(src). But when i create a component, slicemachine saves it in .slicemachinefolder with the storybook, mocks, model files.

And to be honest, i don't know if i should let my components in .slicemachine or i should move to my components folder.

Is there any architecture guide to follow?


1 Like

So the .slicemachine folder is not something that you should ever have to touch or edit. When you click the ' Create a new Slice ' button it will create all the files in the necessary locations as defined in the table here.

As for where your Slice library lives, you define that in your sm.json file as described here.

But you don't want to define this as the .slicemachine folder. You can have it in the root(src) of your project @/slices or nested in the components folder @/components/slices, this is from your preference. It's Slice Machine that adds the correct files in the correct places from this sm.json definition.

1 Like

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

Hi team,

I am currently using the slice-machine-ui@beta version for Nuxt. In my project, my stories are currently being created in a .slicemachine/assets/slices file, each slice folder contains index.stories.js and a mocks.json . However, each time storybook is used the data within these files changes, and thus when opening a pull request I have constant merge conflicts due to the constant updates. I noticed the .gitignore does not contain content within the ./slicemachine folder (such as stories), how is everyone else handling this?

Hi @soheima.canton,

Thanks for reaching out; I have moved your question to this topic as they are highly related.

In fact, the . slicemachine folder needs to be committed, as it is mentioned above, but I understand that it can be annoying if the storybook content changes.

I will try to get some more info and see if it is possible to fix the content generated by Storybook, but it seems to me it is a configuration in Storybook.

@soheima.canton well I've checked with our dev team, and in fact, you don't need to commit the whole folder, all what you need is to commit is .Slicemachine/mock-config.json and the rest is regenerated
every time you hit save in the UI.

So basically you can add the .Slicemachine to .gitignore with an exception to that file.

Hi Fares, firstly thank you for following up I sincerely appreciate it. Is it possible to provide an updated .gitignore example? because I assume others will probably have the same issue.

Thanks Soheima

1 Like

You need to add something like this to your .gitignore file


I haven't tested this but it must be something like this.

1 Like

Amazing! Thank you so much :grinning: