migrate-variants-directive.ts — tailwindcss Source File
Architecture documentation for migrate-variants-directive.ts, a typescript file in the tailwindcss codebase. 1 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 7d3434a3_4704_b7bc_152c_048a7295df0f["migrate-variants-directive.ts"] ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] 7d3434a3_4704_b7bc_152c_048a7295df0f --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 10853aef_1b75_87ab_4c90_e8e234d21371["migrate-variants-directive.test.ts"] 10853aef_1b75_87ab_4c90_e8e234d21371 --> 7d3434a3_4704_b7bc_152c_048a7295df0f 67f80607_3a88_f275_79a1_b9557100d939["migrate.ts"] 67f80607_3a88_f275_79a1_b9557100d939 --> 7d3434a3_4704_b7bc_152c_048a7295df0f style 7d3434a3_4704_b7bc_152c_048a7295df0f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type Plugin, type Root } from 'postcss'
export function migrateVariantsDirective(): Plugin {
function migrate(root: Root) {
root.walkAtRules('variants', (node) => {
// Migrate `@variants` to `@utility` because `@variants` make the classes
// an actual utility.
// ```css
// @variants hover {
// .foo {}
// }
// ```
//
// Means that you can do this in your HTML:
// ```html
// <div class="focus:foo"></div>
// ```
//
// Notice the `focus:`, even though we _only_ configured the `hover`
// variant.
//
// This means that we can convert it to an `@layer utilities` rule. Later,
// this will get converted to an `@utility` rule.
if (node.name === 'variants') {
node.name = 'layer'
node.params = 'utilities'
}
})
}
return {
postcssPlugin: '@tailwindcss/upgrade/migrate-variants-directive',
OnceExit: migrate,
}
}
Domain
Subdomains
Functions
Dependencies
- postcss
Imported By
Source
Frequently Asked Questions
What does migrate-variants-directive.ts do?
migrate-variants-directive.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the UpgradeToolkit domain, Codemods subdomain.
What functions are defined in migrate-variants-directive.ts?
migrate-variants-directive.ts defines 1 function(s): migrateVariantsDirective.
What does migrate-variants-directive.ts depend on?
migrate-variants-directive.ts imports 1 module(s): postcss.
What files import migrate-variants-directive.ts?
migrate-variants-directive.ts is imported by 2 file(s): migrate-variants-directive.test.ts, migrate.ts.
Where is migrate-variants-directive.ts in the architecture?
migrate-variants-directive.ts is located at packages/@tailwindcss-upgrade/src/codemods/css/migrate-variants-directive.ts (domain: UpgradeToolkit, subdomain: Codemods, directory: packages/@tailwindcss-upgrade/src/codemods/css).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free