Twig in Drupal 8 Provides a Simple Yet Effective Method to Create and Maintain Drupal Themes
If you're thinking about upgrading to Drupal 8, it's important to understand that the new method of designing/maintaining Drupal themes is cleaner, easier, and safer compared to Drupal 7 and earlier. We expect Drupal 8 themes to be almost 100% compatible with Drupal 9, which is an absolute first for the Drupal community. All that will be needed to upgrade is to replace depreciated code.
What is Twig and why is it Better?
Drupal 8 moved away from pure PHP-based templates to Twig, a simpler and more secure compiled templating language. The motivation for Twig was the same as moving Drupal to the Symfony platform: adoption of a modern, powerful, OOP-based engine. It removes the requirement that themers understand PHP, and instead provides them with a simple framework to provide the desired layouts. Stated another way, it provides further decoupling of the back and front ends.
Why is Twig more secure than pure PHP? The simple answer is, it doesn't require the designer to sanitize output subject to cross-site scripting (XSS). Drupal essentially automatically sanitizes all output for you. There are many other benefits if you'd like to learn more.
More Themes Coming Soon to this Drupal 8 Demo Site
Currently this Drupal 8 demo has two themes: the one you're seeing now, and an admin theme you can see and try for yourself right now by requesting access on the homepage.
By the end of April, we expect to be adding several Drupal themes to this Drupal 8 demo site that you can view and try yourself, so stay tuned!