public sealed class UtilityGeneratorTurns the utilities a project uses into a stylesheet.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Emitted into @layer utilities, and that one line is what makes the whole system behave. A generated .p-4 is one class and a hand-written .card .body is two, so on specificity alone the utility loses every time and the only remedy is !important on everything the generator produces. With a layer the question is settled once, declaratively, and specificity never enters into it.
Only the utilities that are used are emitted. The alternative — every combination of every family and every token — is a stylesheet in the tens of megabytes, and the scanner exists so that nobody has to think about that.
Fields and properties (2)
public IReadOnlyList<string> UnrecognisedThe candidates that looked like utilities and were not ones.
public int RuleCountHow many rules the last generation emitted.
Methods (3)
public UtilityGenerator(ThemeTokens tokens)Creates a generator.
public string Generate(IEnumerable<string> candidates)Generates a stylesheet for a set of candidate class names.
public static string Escape(string name)Escapes a class name so it can be a CSS selector.
Used by (3)
- ThemeAndScannerTestsVixen.Ui.Styling.Utilities.Tests
- UtilityFixtureVixen.Ui.Styling.Utilities.Tests
- UtilityGenerationTestsVixen.Ui.Styling.Utilities.Tests