The code in block--lb-hero--canada-*.html.twig contains highly duplicated code. In order to maintain a DRY codebase and reduce our codebase “weight”, we should de-duplicate code wherever possible.

A possible model for this could be:

  • block--lb-hero.html.twig contains the base code for all variants with block statements and switching logic.
  • set statements should all be made before any div to maintain separation of concerns.
  • block--lb-hero--canada-*.html.twig have set statements to assign variables, then use extends to reference the base template.

Acceptance Criteria

  • code diff should have lots of deletions
  • front-end should have no changes from prior behavior
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david-b created an issue. See original summary.

  • david-b committed 7c6fa2d8 on 1.1.x
    Issue #3404032: De-duplicate code in twig templates
    

  • david-b committed 2cd2f5b0 on 1.1.x
    Issue [#3404032]: exclude content from twig template
    
froboy’s picture

Version: 1.1.0 » 1.1.1
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.