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?
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?
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.
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
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
6
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
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?
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.
I noticed that sometimes mock data under .slicemachine is being re-generated pretty randomly. For example, I'm working on slice Foo, but when I'm about to commit my changes, .slicemachine/assets/slices/Bar and .slicemachine/assets/slices/Buzz are also updated. However no changes has been applied to them.
As a result it's pretty annoying to rollback unnecessary changes every time I want to push changes to code review, cause I don't want to confuse reviewers with non-relevant changes.
I tried to add everything except of .slicemachine/mock-config.json to gitignore, but it seems like it's not regenerated on startup. For example, if you remove .slicemachine/assets, there's no chance to generate mocks and screenshots manually. I have to edit slice and hit "Save to filesystem", which is a no go.
Do you have any recommendations on how to manage this folder in my case?
I just want to avoid random regeneration of slices that I don't touch during a bug fix or while working on a new slice.
I haven't seen this behaviour in any of my projects. In this case, it might be better to just commit your entire .slicemachine folder so that nothing is changed or needs to be regenerated when you pull the repo.
I'll bring this up with the team and see what insight they can give me.
If I delete the stories (I am using Storybook), it doesn't automatically regenerate the files. So might be worth committing the whole .slicemachine folder?