Hi Guys, i hope you well.
I'm creating a single codebase and i want to use slicemachine in it. Now, i have a doubt... is there any way to use only one codebase to multiple slicemachine?
In the file:
sm.json, we have the apiEndpoint property. I thought about do something like that:
So with this, i could run:
PRISMIC_PROJECT=my-prismic yarn start
PRISMIC_PROJECT=my-prismic-two yarn start
Is possible do something like that?
@Phil can you help me with this?
Can you say more about your use case? Are you going to duplicate the codebase for multiple projects, or do you want to switch between repositories in one app? What is this for?
I want to swtich between repositories in one app (codebase).
is it possible?
I've never seen anyone try that before. Why do you want to switch between repositories in one app? (If I understand your app better, I can give better suggestions.)
We want a single codebase for multiple websites. We have done it before, because our codebase is generic and we need only to change the prismic api. So we do it, based on a environment variable.
But, we can't do this with slicemachine. Because the slicemachine create a
sm.json file and there's an
Can you understand now?
Thank you so much.
The main benefit of Slice Machine is for modelling content in your Prismic repo. If what you're describing is possible (though I'm not sure it is; I'll check with my team), you would have to manage your Custom Types and Slices separately for each repo. That means if you change your Custom Types or Slices, you would have to change the environment variable to push the changes to each repo. Is that what you have in mind?
Env variables and Slice Machine have previously been discussed here:
We are looking to have the apiEndpoint in the sm.json file be one of 2 values depending on the branch. Is there any way to do this currently?
As a workaround, we are thinking we will remove the file from version control and generate it as a build step based on the environment variables.
Although, it's not possible at the minute, but tracked as a feature request.
(This is something the team really wants to implement but it’s not in the pipe right now. If you have a certain scripted flow, you can rewrite the manifest whenever necessary of course.)
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.