7

How can I update my YAML files for local disconnected mode development from Sitecore, as same as Connected mode. As We have a team who is working on Sitecore and another team is working on front-end in disconnected mode. I know we can use :connected mode for development but I need the same data in disconnected mode also. How can I update that .yml files.

2
  • Nice idea for a module: Unicorn YML -> JSS Disconnected YML :-) Commented Jan 18, 2019 at 11:57
  • anyone have the solution or please share any idea or any link/blog that helps. I need it badly. Commented Jan 21, 2019 at 8:01

1 Answer 1

3

There are no tools built into the JSS SDK to retrieve and store Layout Service data as files.

When disconnected data is imported into Sitecore, it is "expanded" to reflect the data schemas you have defined in disconnected mode. In other words, component definitions, route data, content data and everything else you define in disconnected mode become templates, renderings, data source items, etc... in Sitecore.

At that point, it becomes extremely difficult to "export" everything that has been expanded and make it available again as disconnected data in the same/similar structure as you defined it originally in disconnected mode. And make that data import-able again. This is especially true for shared data/components.

If you have backend/frontend teams working in tandem on a JSS site / Sitecore instance, it is recommended that you try to use Connected mode in this scenario. Also, once Sitecore becomes the "source of truth" for your data, be sure to exercise caution if importing templates/components/renderings (e.g. disconnected data) into Sitecore so as not to break anything the backend team may have implemented.

All of that said, your JSS app is essentially built to consume and render data made available via Layout Service. And you are not required to use the mock Layout Service that the sample apps use. There is nothing preventing you from saving Layout Service data queried from Sitecore into a JSON file. Once you have that data locally (disconnected), you might consider building your own service layer to fetch "raw" Layout Service data from the JSON file(s) you saved.

For instance, wherever you currently call dataApi.fetchRouteData, you can add a conditional statement, e.g.

if (inDisconnectedMode) {
  fetchRouteDataFromLocalFile();
} else {
  dataApi.fetchRouteData();
}

Related question (but similar answer: Any way to remove disconnected manifest processing?)


UPDATE (2019-04-26)

If you absolutely need to export JSS app data/definitions from Sitecore into disconnected data (as opposed to working in Connected mode), you may want to consider Umbrella for Sitecore JSS: https://github.com/macaw-interactive/umbrella-for-sitecore-jss

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.