Skip to content

The config file explanation

Matouš Borák edited this page Aug 4, 2024 · 6 revisions

The sections in the YAML config file have the following meaning:

  • regexes - the regular expressions needed to match the classes in files; there may be any number of them in the config file and the script will first select those regexes that are configured for the current file extension
    • the regex should always include the following named groups:
      • before - optionally matches something that must be present on the line before the classes sequence itself; this group can be empty and will be echoed on the output, unchanged
      • classes - this group matches the sequence of classes itself; this part of the regex will be substituted with reordered classes
    • the regex configuration:
      • file_extension - determines for which files this regex will be applied
      • class_prefix - the prefix that is present before each class (can be empty)
      • class_splitter - the char / string that is used to join the classes into the sequence (can be empty)
    • we heartily recommend using Rubular to test your updated regular expressions
  • variants_order - if a class contains multiple variants (e.g. hover:sm:block), the variants themselves will be reordered according to this list
  • classes_order - determines the order of the classes themselves
    • the classes can be specified either as strings or as regular expressions (useful for covering multiple similar variants of a class name)
    • if the classes are filed into groups here, the classes with variants will be ordered last in the given group
    • if you always want the variants to be ordered last, just dump all classes to one big group here
Clone this wiki locally