Skip to content

Add script to compare Tailwind equivalents

Peter Hegman requested to merge add-script-to-verify-tailwind-equivalents into master

What does this MR do and why?

How does the script work

  1. Adds all the Tailwind CSS equivalents to config/helpers/tailwind/all_utilities.haml so they will be generated by Tailwind CSS
  2. Loops through the legacy CSS utils in scripts/frontend/tailwind_equivalents.json and compares the CSS properties to the Tailwind CSS equivalent
  3. If there is a mismatch it outputs it to the console
  4. If the mismatch is not an issue (such as border-top: 0 vs border-top-width: 0) then you can add it to the mismatchAllowList object and it will be skipped.

This script will also be helpful for continuing to build tailwind.config.js. When we add to the config we can update the corresponding legacy CSS utils without a Tailwind equivalent (set to null) and then run the script to verify they match.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Update a util in scripts/frontend/tailwind_equivalents.json to a Tailwind equivalent that is not configured or is a mistake (typo)
  2. Run node ./scripts/frontend/compare_tailwind_equivalents.mjs
Edited by Peter Hegman

Merge request reports