Theming in Drupal 8
The introduction of Drupal 8 is sure to create a flutter in the web development circles; this latest version of Drupal, with cutting-edge features, is certainly promising some radical changes. Drupal 8, which embraces a variety of technologies including Symfony, Backbone, Twig, and YAML, is all set to create a revolution in the crowded CMS market.
For example, with TWIG, a favourite PHP template engine has been incorporated in Drupal 8, enabling the use of much more secure and robust themes.
So, here is a brief introduction to Theming in Drupal 8:
Introduction of Twig: Drupal 8 has accepted Twig as its template language and this sets it apart from the others in this business. The twig themes are extensible; this implies that only the required bit connected to it are defined and the remaining are inherited from the parent. Remember that there won’t be any theme functions here, therefore making every themable output use an html.twig file. Themers will surely rejoice at this bit of information about Drupal 8.
Upgraded Templates: The Classy theme is instrumental in organizing the template files in a neat manner, as in Drupal 8 we are in total control of the mark-up of the site. The documentation of all these template files is at the top, with information about the available variables. Twig filters and functions can be used to manipulate the data directly from the template files. In order to bypass unnecessary function calls, it is highly recommended to build translatable strings directly than from the pre-processor.
De-bugging: There are a lot of improvements made on the debugging of theme information. Therefore, when you switch on the twig debugging, a set of useful HTML comments pop up. You don't have to try to know what to override, as you can view the template file that is responsible for a particular mark-up, its location, and which theme suggestions can be used.
Also Twig has a brand new dump() function whereby a particular variable to the page can be printed out and if that’s limited, the Devel module incorporates the kint() function which gives access to a variable inspection tool.
Libraries and Assets: Drupal 8 is coupled with the latest of front-end libraries like Underscore.js, Modernizr, and Backbone.js along with JQuery 2.x, and with the inclusion of a SMACSS based CSS file organization, this seems like a no-mess theme.
Drupal 8 is all set to make life easier and hassle-free for web development teams and Zyxware is at the forefront of making these changes. Call us today if you want to migrate to Drupal 8 or wish to know more about our Drupal development services. Our teams are more than ready to support your organization with the necessary resources.
References: