Click here to watch Twig is dead. Long live Web Components!
<hyperbole-alert> Everyone is excited about Drupal 8’s Twig system, but it's already dead to me.</hyperbole-alert> The W3C is working on a specification for a templating system that is native to the HTML language, called Web Components.
With web components, we’ll be able to define and instantiate our own templates from within HTML. We can even create our own custom elements. Best of all, with the Shadow DOM, our templates encapsulate styling (CSS) and behavior (JS) within them, eliminating conflicts and easing integration of multiple building blocks.
There is so much awesome in the Web Components spec, but switching to it will make switching to HTML5 look like a cake walk. There is a lot to do! (And the spec is still unfinished!)
Will Web Components be ready to use for Drupal 9? (dunno.) Will we be ready to use them? (you bet!)
But we have to start planning now and start evolving our current codebase (including Twig) to make the transition easier. By building component-like bundles of CSS, Twig templates, and JavaScript into Drupal 8 (and 9), we can bring the core concepts of Web Components into Drupal right now!
In this session, I'll give a brief demo of Web Components and the Shadow DOM, discuss the benefits, and then we can hash out a plan of attack.
Comments
John is smart and this is smart
Ignoring web components would be foolish to the point of comedy. Please allow John to present these concepts or suffer drastic problems with Drupal's ability to modularize its front end in a few short years.
Also note that there are already JS libs that make this possible in browsers today:
http://www.polymer-project.org/
http://mozilla.github.io/brick/
The video is probably not very good
I wanted this session to be a conversation, so we didn't line up next the mic and take turns; we just talked and ignore the mic. It was important to have this kind of dynamic conversation, but I apologize to those who weren't able to attend and were hoping to watch the video. I promise to write this up as a blog post.
In the meantime, Brian Krall wrote up his notes here: https://www.evernote.com/shard/s409/sh/d01115df-20b2-4ec3-b566-90abf38e4... Thanks, Brian!
Slides!
I realized the slides would be less useful than me just pasting the resources links into this comment, so… here you go!
http:// css-tricks.com/modular-future-web-components/
http://5by5.tv/webahead/66
http://WebComponents.org
http://www.polymer-project.org/
http://x-tags.org/
http://bosonic.github.io/
React @ JSConf EU
https:// www.youtube.com/watch?v=x7cQ3mrcKaY