Skip to content

Applies audit classes to Twig HTML elements, helping debug Twig template hierarchies

Notifications You must be signed in to change notification settings

patrickmaynard/audit-class-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audit class generator

This simple package adds pseudorandomized audit tags to your Twig html class definitions.

This can be useful if you don't have traditional debugging tools available.

By seeing a short, pseudorandom audit tag among the classes applied to an html element, you can quickly determine exactly which Twig template the html element came from.

That can save significant debugging time, since you don't have to guess at which Twig template to modify for a given task.

In other words, if you can view source in a browser, you can now grep definitively for any HTML tag that already has a "class" attribute, finding exactly which Twig template that DOM element came from. Pretty neat!

Installation

To install this tool as a dev dependency:

composer require --dev patrick-maynard/audit-class-generator

Installing this in a production environment is not recommended.

Usage

One the tool has been installed, you can use the following command to open a new git branch and apply the temporary audit classes to any Twig html elements that already have a "class" attribute defined.

vendor/patrick-maynard/audit-class-generator/apply.php

Then view the source of the page you want to debug in a browser.

You'll see that any tag that already had a "class" attribute now has a unique,
pseudorandom class that looks something like audit_34f39d or such appended to the class list.

Just grep for that audit class, and you'll find the Twig template you want in a jiffy.

Happy debugging!

About

Applies audit classes to Twig HTML elements, helping debug Twig template hierarchies

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages