Drupal JavaScript Server Side Rendering

How ever dominant, even the world of Drupal cannot stay put to the technologies from it’s beginnings in 2001.

The Open Source community and Acquia did a significant investment in renewing the inner workings of the product in Drupal 8 — and continues to do so.

After that the focus has moved on to improving the front end. Year 2015 may have been the year of JavaScript fatigue for many, but the Drupal community is just getting started.

One of the key thing mentioned a lot is Server Side rendering of React.js or Angular 2 Components. For many these seem foreign at first, best experienced in a pure JavaScript implementation like WordPresses Calypso shell.

In reality introducing server side rendering with PHP environments like Drupal is not that difficult, initial server setup adds complexity, but once that is out of the way it’s pretty straightforward:

PHP could technically be used to render React components in native PHP. Since the community would need to maintain compatibility and feature parity with JSX and React itself, it is not feasible. This takes us into the ways that we can render React components in PHP:
- Use the V8Js extension to run an embedded V8 engine
- Execute node.js processes on demand
- Run a node.js rendering daemon for rendering
Introduction to React.js Components and Server Side Rendering in PHP

On top of those options you can use convenience methods like Rendering JavaScript Components in Twig. So what seems confusing at first, is once again not that complicated once you get around to it.

More relevant reading on the subject:

Happy rendering! :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.