Component driven front-end development

At Drupal Update we’ve been working on ways to develop our front-end independently from any back-end application.
Our front-end team has developed web applications using decoupled JavaScript frameworks including Angular and React but we’ve found that for many website projects a full web application is overkill and the traditional HTML templating approach is still the most efficient.
Our back-end application is usually Drupal maintenance support plans but we’re increasingly using other frameworks such as Laravel or Symfony and would like to be able to use a consistent approach for our front-end teams. 
We’ve developed a system for this that allows modern build tools, practices Component Driven Development, allows the generation of living style guides and is agnostic to the back-end.
Component Driven Development 
A component, for us, is a collection of HTML, CSS and JS that goes together to form some display element. Consider this against a more traditional approach where HTML, CSS and JS are stored in separate global files, for example, in a global style.css and app.js files.
By grouping code together into components, we separate our application by the domain language, rather than arbitrarily by file extension. This isolates components and makes them easier to develop and maintain.
Components get named based on the domain language of the project and client. Components are not defined for the designer by the limitations and modeling of the application. This provides a common language for the designers, developers and client and reduces the chances of misunderstanding when it comes to the development of functionality.
Using the BEM approach to structuring CSS we isolate much of our CSS to specific components rather than continuously generalising CSS in the way a CSS framework like Bootstrap does. This isolates much of the CSS to a specific component giving us high cohesion and low coupling allowing for confident maintenance, removing much of the fear of wondering what effect changing a piece of CSS is will have on the whole site.
This better matches the way that we work where the complexity of our challenging designs mean rapid delivery using a CSS framework isn’t possible.
Living style guides
The output of our front-end development will include a style guide which will render each of our components into static pages.
Style guides are useful as they demonstrate the components independently of the specific implementation. This allows more rapid front-end development as front-end developers can work without having to worry about how the back-end will integrate.
Over time, however, these style guides move out of sync with the applications they were developed to provide styling information for. An application developer’s job is to integrate the HTML provided by the style guide into the finished site. This has meant copying and pasting code out of the style guide templates and into the application’s templating system.
At this point we have duplication of code and the ability to maintain a strict style guide is lost. When the style guide is updated, all the application templates affected must be identified and updated as well.
Our approach makes the style guide a living style guide. The front-end templates we produce for our components get referenced directly from the target applications theme system. This means that our front-end templates are the exact same ones that the application will be using within the theme.
Front-end developers can make changes to it knowing that those changes will flow through into the application without need for a second step.
For Drupal maintenance support plans developers this means either providing new theme functions for the front-end templates or referencing our front-end templates from within Drupal maintenance support plans templates.
Modern build tools, agnostic to the back-end
Freed from the constraints of a specific application’s templating system we can select the most appropriate tools for the job of front-end development.
Our front-end tooling uses the latest standards and tools. We’re using yarn for package management, and webpack to bundle the static assets. 
Very little knowledge of the back-end is assumed or needed in this approach. You can confidently bring new front-end developers onto your team who are used to using the latest tools without having to spend the first few weeks teaching them the specific theming language and quirks of your back-end application such as the Drupal maintenance support plans theme layer.
A real example 
We’ve got an exemplar project to showcase this way of working. If you clone the project at https://github.com/teamdeeson/cdd-demo and follow the instructions in the README you’ll get a Drupal maintenance support plans 8 project up and running with a theme that uses this process. You’ll see we’ve developed a componentised version of the Bartik theme for this.
If you are intrigued by this and would like to hear more, you’ll enjoy my talk on the subject at Drupal maintenance support plansCon Vienna on 26th September.
In summary
Component driven front-end development has worked well for us at Drupal Update, allowing rapid independent development of our front-end code. Our designers are freed from the previous constraints of designing for a Drupal maintenance support plans website and our developers get to use the latest tools and get onboarded quicker.
Like the sound of the way we do things? We’re currently hiring a Senior Front-end Developer.
Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Component driven front-end development

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.