Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Frontend in Drupal: Ready for the Front Page?

DZone's Guide to

Frontend in Drupal: Ready for the Front Page?

Get an illuminating peek in to the trajectory of Drupal, and how it got to a great place for frontend development with Twig and headless.

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

For years, Drupal frontenders have felt like their work was an afterthought. Core contributors spent most of their time on performance and structural enhancements. Conferences highlighted new, exciting backend and devops technology, while dedicating only a few discussions to what happens at the layer above: design, UX, and UI.

Morten Birch (aka mortendk) has been a part of the Drupal frontend scene for nine years. As a web developer since ‘96, he’s been through the days when improvements in frontend development were largely “quick fixes”. But now he expects them to be more significant changes, lasting five years or more. If he’s right, he may be the driver of one of the biggest changes in Drupal for years—an overhaul of the Drupal approach to frontend.

Why Frontend Wasn’t Important for a Long Time

Historically, Morten says, open source projects can get very big and complex. With a lot of stakeholders, the projects tended to put frontend low on the priority list.  “For a long time, people weren’t thinking that much about the work done by frontend developers. They expected us to put pretty colors on things and call it a day.” When he discovered Drupal, he felt things begin to click. But he still saw people treating frontend like an addon, overlooking the importance of things like markup, CSS, and browser testing.

In the early 2000s, Morten showed up at DrupalCon DC with a few frontenders, including John Albin. They’d been trying to garner more respect for frontend with only minor success—only a few sessions made it into the conference agenda that year out of hundreds on the schedule. So they did what marginalized frontender would—they hijacked a BoFroom (an open spot to meet without a pre-planned agenda) and entertained a crowd with their own discussions on how to drive change within the Drupal community.

With determination and a lot of noise-making, Morten and John made that event somewhat of a turning point for Drupal frontend. The organizers agreed to add 8-10 sessions for next time, dedicated solely to design, theming, and UX. It was the beginning of a bigger conversation that posed the question to the large community of Drupal developers: “Are we doing it right?”

A Complete Overhaul of Drupal Frontend

Morten and his frontend enthusiasts held Frontend United, a conference in Amsterdam dedicated to design and theming sessions for Drupal developers. 250 people showed up with plenty of ideas on what they wanted to see happen—things like building themes without an API, a better way to find and manage files, a way to write less custom code but still get the deeply interactive and engaging user experiences they wanted. That same weekend, developers were meeting in San Francisco. As an outcome of a day-long discussion at Frontend United, recommendations were sent to the Bay Area, where their SF counterparts presented an idea that would overhaul the current templating system for Drupal: Twig.

Twig, the New Default Templating Engine in Drupal 8

The developers meeting in San Francisco thought Twig, the new theming layer they were cooking up for Drupal 8, might be what Morten and his angry themers were looking for. They warned that it would be a lot of work—and it was. Collectively they decided to go for it—destroy the old system from the ground up and work to make Twig the answer to the Drupal community’s longstanding frontend woes. Morten became the point person for spreading the word, and there’s not a much better person for the job. While he knew he’d be pushing against some of community he was willing to put it all out there. He started traveling to camps and explaining all that was wrong with Drupal 7, rallying coders and contributors and making things happen.

"The last couple of years we’d had a small group of four or five people really cranking away at it, they’re really dedicated. Developing for core is hard, and you have to really want to do it, but you can make big changes.”

Now, Drupal 8 and Twig has evolved from idea to reality. Contributors are testing and putting the final touches on a stable version slated to come out this fall, but many developers are already using it. Twig, part of the Symfony2 framework and a replacement for PHPTemplate as Drupal’s default templating engine, offers a few enticing improvements. It gives designers more readable code, consistency in overriding parts of Drupal core, a simpler theme structure, and elimination of much of the duplicate code issues found in Drupal 7.

What About Headless?

Headless, or decoupled Drupal, has been another hot topic in the frontend world (Check out our Decoupled CMS resource page). Some developers prefer the flexibility and creativity it allows them, while others prefer the built-in functionality of the Drupal theming system. A growing number of developers, especially those at agencies catering to varied client specs, find use cases for both. When asked about the increasingly popular decoupled conversation, Heide explained his stance. “Developers came to me and said, ‘Twig is what we’re working on, and it will change everything’. When I saw what we could do, I was sold. But yes, of course headless has potential to do some really cool things. I think it’s great that developers have more tools to work with.”

If you’re wondering what those cases are, take a look at Josh Koenig’s recent post, where he spent some time explaining decoupled architecture in both WordPress and Drupal, or our case study with Manatí, an agency that paired a Drupal backend with Angular.js and a robust maps API to let users easily contribute content.

I don’t see headless as a competitor. It’s going to have significant impact, in a good way—it’s just going to give people more options.

Still, Morten admits he’s been focused on Drupal 8 theming—and has high hopes for its long-term viability. “Some people just want to build a site, without a node server or anything. There will be a lot of new Drupal developers who are excited about the frontend possibilities in D8, and they’re the ones who will help guide us in how to keep making improvements.”

What the Future Looks Like for Drupal 

At this point in his journey fighting for the frontend cause, Morten is confident that he and his cohorts have a good idea of what people want—and that Twig is on the right track. But he knows it’s easy to get off-course in a leadership role, forgetting what people who use D8’s theming every day might need as things progress. The answer to staying on track, he believes,  is dedicating a great deal of time to testing and getting feedback to refine and improve upon what they’ve started.

At the end of the day, what I wanted to do nine years ago—and what I still want to do—is to let developers build great things and designers make them look amazing.

He gives the website management platform a shoutout, too. Having known the Pantheon team for years, he cites platforms like ours as allowing developers to focus on their specialties. “When you guys came around, I thought, ‘Great, I don’t have to think about the backend and the infrastructure anymore.’ It made sense”. His vision is that frontend developers will just get to design, build themes, and find ways to improve frontend architecture. “I don’t care about servers and deployment,” he said. “It’s so far from what I do”.

He expects some renewed hype around Drupal as developers find more and more flexibility for interesting frontend advancements. In fact, his prediction is that new theming system (along with configuration management) will be one of the two most impactful changes in Drupal.

This is going to be the biggest change, and the biggest thing driving the drupal adoption rate. Because it’s gonna be so damn easy as a web designer to get things done.

After years of pushing for change in the Drupal community, Morten’s finally getting to sit back and see some of the effects. While it’s easy to worry that they made wrong decisions, he noted (“No guts, no glory!”),  it’s incredibly encouraging coming to an event like DrupalCon and watching frontenders get excited about building Drupal sites.

“We’ve made some pretty significant changes. It’s time to start viewing Drupal 8 as a finished product, keep making improvements, and enjoy what we’ve built,” says Morten. If the hype at Drupal camps all over the world this year is any indication,  Morten and the Drupal Twig contributors who’ve dedicated many, many hours of their careers to Drupal 8 will have a lot to enjoy.

You can learn more about Drupal 8 theming on the Twig website and by reading the Drupal 8 theming guide. Or, watch Morten’s session on D8 theming at DrupalCon LA.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:
drupal ,twig

Published at DZone with permission of Laura Dambrosio. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}