7

Has anybody integrated SDL Web 8.5 with AngularJS or vue.js? Which are the main inconveniences or pitfalls that you have found?

We are actually using DXA, I guess that in this case you can use DXA as a JSON provider for entities, but as an MVC model, you can't use it in frontend.

1

2 Answers 2

10

I've seen an implementation DXA was set up to just be a JSON API. Vue.js was used as the templating framework.

XPM was dealt with by using .NET Core to render VueJS server-side (So XPM was accessing fully-rendered pages).

Webpack was used to bundle and transpile all the Vue.js code and helpers. The downside to this is that all of the state existed server-side.

If you were using Angular, you could do the same thing; there's a .NET core Angular renderer out there

One of the real advantages to a client-side MV* framework is being able to change state. So in this approach, you're really not able to appreciate that flexibility.

That's part of the reason we need something like DXA-JS. As Bart's pointed out, the DXA 2.0 Model service is coming. At the MVP retreat, we produced a POC of how it could work. I wrote a small introduction to DXA-JS explaining the vision a bit.

What you'll find from that POC is that you can template without even using a "templating framework". The latest version of JavaScript (ES6 and up) has enough built-in features that allow "easy" templating. Of course, I wouldn't recommend that approach just quite yet.

What our POC proved is that you don't need a framework, but, if you wanted to use one, any of these frameworks would be fine:

  • React
  • Preact
  • Vue
  • Handlebars
  • Angular

DXA-JS will (eventually) be an NPM library that can be bundled in via Webpack, or natively, and will act as your "state provider". Ideally, it'd give you the model information, routing information, and whatever else, that would allow you to seamlessly implement server-side and client-side renderings in the JS-Framework-du-Jour.

10

The problem with using DXA 1.x for a client side JavaScript framework is that you are using a fully blown MVC web application to essentially deserialize JSON and map it to models. It can certainly do it, but it isn't quite an optimal solution.

SDL Tridion Docs (formerly Knowledge Center) has done something similar by adding a REST endpoint to DXA 1.8 to enable their React application. See also https://docs.sdl.com/LiveContent/content/en-US/SDL%20Knowledge%20Center%20full%20documentation-v3/GUID-8D7C4485-F7B5-4403-A715-92D4D8115B12

The idea of DXA-JS (https://github.com/sdl/tridionmvp-dxa-js), which we started to investigate at the 2017 Tridion MVP retreat, was to use the DXA 2.0 Model Service instead. This project started as a proof of concept to investigate what can be done and see where the gaps in the offering exactly are. The DXA 2.0 Model Service was designed to not just deserialize the JSON, but actually also do model mapping, this however is a feature we scoped out for the initial release due to time constraints.

Right now the release for DXA 2.0 is planned in January 2018 and we will release it with the Model Service marked as internal API. The idea behind this is that the SDL Tridion Sites 9 release (planned mid 2018) will contain a public Content API that will replace the DXA 2.0 Model Service. DXA will then also get an update to use this public Content API, and that is something which would be ideal to base an actual DXA-JS on.

Your Answer

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

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