Site icon Hip-Hop Website Design and Development

Component driven front-end development

At WordPress 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 WordPress 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 WordPress maintenance support plans developers this means either providing new theme functions for the front-end templates or referencing our front-end templates from within WordPress 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 WordPress 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 WordPress 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 WordPress maintenance support plansCon Vienna on 26th September.
In summary
Component driven front-end development has worked well for us at WordPress Update, allowing rapid independent development of our front-end code. Our designers are freed from the previous constraints of designing for a WordPress 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