Reader small image

You're reading from  Modernizing Drupal 10 Theme Development

Product typeBook
Published inAug 2023
PublisherPackt
ISBN-139781803238098
Edition1st Edition
Concepts
Right arrow
Author (1)
Luca Lusso
Luca Lusso
author image
Luca Lusso

Luca Lusso is a Drupal developer with more than 15 years experience, he started with Drupal 5 and PHP 5 in an era where deployments with FTP were still a thing. Since then, he worked as a consultant and contributed to build some of the biggest Drupal websites in Italy. Luca is also a teacher and he has taught Drupal to a lot of different teams, from universities to big system integrators. Luca is an open source lover and Drupal contributor, he maintains some popular modules like WebProfiler and Monolog. He's also a speaker in conferences like DrupalCon Europe and Drupal Developer Days. Lately, he has shifted his interest towards frontend performances. Luca holds a master's degree in Computer Science and he's an Acquia certified developer.
Read more about Luca Lusso

Right arrow

Ensuring coding standards

We will write a lot of code to implement the requested layout and we will use different languages (Twig, HTML, CSS, and JavaScript). To avoid every developer using their own style, we must define a set of rules that everyone in the team has to adhere to. This will greatly simplify the task of reading the code for other developers, and also help when reviewing code changes.

Drupal defines a set of tools and rules for its own files, and we should use the same standards too.

We’ll use different tools for different languages:

  • Stylelint for CSS files
  • ESLint for JavaScript files
  • PHPCS for PHP files

Stylelint

To add Stylelint (https://stylelint.io/) to our theme, follow these steps:

  1. Open a shell into the web container:
    ddev ssh
  2. Then go to the theme folder:
    cd web/themes/custom/alps_trips
  3. Install the required packages:
    yarn add –D stylelint stylelint-config-standard stylelint-config-tailwindcss stylelint-order...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Modernizing Drupal 10 Theme Development
Published in: Aug 2023Publisher: PacktISBN-13: 9781803238098

Author (1)

author image
Luca Lusso

Luca Lusso is a Drupal developer with more than 15 years experience, he started with Drupal 5 and PHP 5 in an era where deployments with FTP were still a thing. Since then, he worked as a consultant and contributed to build some of the biggest Drupal websites in Italy. Luca is also a teacher and he has taught Drupal to a lot of different teams, from universities to big system integrators. Luca is an open source lover and Drupal contributor, he maintains some popular modules like WebProfiler and Monolog. He's also a speaker in conferences like DrupalCon Europe and Drupal Developer Days. Lately, he has shifted his interest towards frontend performances. Luca holds a master's degree in Computer Science and he's an Acquia certified developer.
Read more about Luca Lusso