Frontend
These are still being discussed: https://www.drupal.org/project/drupal/issues/3002762
Coding standards
When is this needed?
Changes to CSS or JavaScript
Details
There’s linters setup to make sure all of the CSS and JavaScript code follows Drupal coding standards.
Resources
https://www.drupal.org/node/2274223
https://www.drupal.org/node/2868114
BEM
When is this needed?
Changes to classes or CSS
Details
All new classes and selectors should take into account the BEM guidelines. Refrain from using overqualified selectors, for example, a.link should be just .link.
Resources
Backwards compatibility
When is this needed?
Changes in preprocess functions, templates or CSS
Details
Most changes to markup or CSS will be considered as BC breaking. Drupal core Stable and Classy themes are backward compatible. Changes to non-backward compatible themes will be easier, thus should be preferred.
Resources
https://www.drupal.org/core/d8-bc-policy#themes
https://www.drupal.org/core/d8-frontend-bc-policy
Browser compatibility
When is this needed?
Changes to markup, CSS or JavaScript
Details
Drupal core promises to support a set of browsers. When making any changes to markup, CSS or JavaScript it is important to ensure that the change is compatible with all supported browsers.
Resources
https://www.drupal.org/docs/8/system-requirements/browser-requirements
JavaScript Transpilation
When is this needed?
Changes made to JavasScript
Details
All patches with changed files must include an ES5 transpilation of ES6 code.
Resources
https://www.drupal.org/node/2815083
JavaScript selectors
When is this needed?
Changes to selectors used in JavaScript
Details
When attaching JavaScript to markup, it should be done using either js- prefixed classnames or data-drupal-selector data attribute.
Resources
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion