Stylesheet Class — tailwindcss Architecture
Architecture documentation for the Stylesheet class in stylesheet.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD b9897393_3e36_7806_d172_b9debcd215f6["Stylesheet"] bc267e18_3e03_cc17_3da0_cbc39f148f44["stylesheet.ts"] b9897393_3e36_7806_d172_b9debcd215f6 -->|defined in| bc267e18_3e03_cc17_3da0_cbc39f148f44 cfe5faf0_6df4_9cfd_d25c_1dcf672e58ea["load()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| cfe5faf0_6df4_9cfd_d25c_1dcf672e58ea ad6791c1_558e_31b6_3be7_e2ace1f1c4c9["loadSync()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| ad6791c1_558e_31b6_3be7_e2ace1f1c4c9 ec11586e_b7a4_c86a_a7da_b615801ad878["fromString()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| ec11586e_b7a4_c86a_a7da_b615801ad878 6df45c70_0c27_5b96_717a_5a24abadaaf4["fromRoot()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 6df45c70_0c27_5b96_717a_5a24abadaaf4 e53d8868_df7c_0b3a_e9cc_7b8e6f92f452["constructor()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| e53d8868_df7c_0b3a_e9cc_7b8e6f92f452 e06bfd1f_30c5_914b_b294_ce3961d3d720["importRules()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| e06bfd1f_30c5_914b_b294_ce3961d3d720 2e389bd1_172a_d911_2bfa_1545772ea7a3["isEmpty()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 2e389bd1_172a_d911_2bfa_1545772ea7a3 9f5a8c9f_6828_fe75_f38e_72ee4cf3c428["ancestors()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 9f5a8c9f_6828_fe75_f38e_72ee4cf3c428 465fb269_beb8_5187_e963_cff3f69bb398["descendants()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 465fb269_beb8_5187_e963_cff3f69bb398 283bbe03_c84a_2fd0_18b3_45f5bfcaa273["layers()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 283bbe03_c84a_2fd0_18b3_45f5bfcaa273 e0e4bc64_eafc_ed6c_bc8e_0da0dbd6dc2a["pathsToRoot()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| e0e4bc64_eafc_ed6c_bc8e_0da0dbd6dc2a 65bf5d7b_4133_6a0b_291b_ac92d67c696b["analyzeImportPaths()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| 65bf5d7b_4133_6a0b_291b_ac92d67c696b f4a0c827_2157_3b45_341e_8e95b4006a27["containsRule()"] b9897393_3e36_7806_d172_b9debcd215f6 -->|method| f4a0c827_2157_3b45_341e_8e95b4006a27
Relationship Graph
Source Code
packages/@tailwindcss-upgrade/src/stylesheet.ts lines 18–298
export class Stylesheet {
/**
* A unique identifier for this stylesheet
*
* Used to track the stylesheet in PostCSS nodes.
*/
id: StylesheetId
/**
* The PostCSS AST that represents this stylesheet.
*/
root: postcss.Root
/**
* Whether or not this stylesheet is a Tailwind CSS root stylesheet.
*/
isTailwindRoot = false
/**
* The Tailwind config path that is linked to this stylesheet. Essentially the
* contents of `@config`.
*/
linkedConfigPath: string | null = null
/**
* The path to the file that this stylesheet was loaded from.
*
* If this stylesheet was not loaded from a file this will be `null`.
*/
file: string | null = null
/**
* Stylesheets that import this stylesheet.
*/
parents = new Set<StylesheetConnection>()
/**
* Stylesheets that are imported by stylesheet.
*/
children = new Set<StylesheetConnection>()
/**
* Whether or not this stylesheet can be migrated
*/
canMigrate = true
/**
* Whether or not this stylesheet can be migrated
*/
extension: string | null = null
static async load(filepath: string) {
filepath = path.resolve(process.cwd(), filepath)
let css = await fs.readFile(filepath, 'utf-8')
let root = postcss.parse(css, { from: filepath })
return new Stylesheet(root, filepath)
}
static loadSync(filepath: string) {
filepath = path.resolve(process.cwd(), filepath)
let css = fsSync.readFileSync(filepath, 'utf-8')
let root = postcss.parse(css, { from: filepath })
return new Stylesheet(root, filepath)
}
static async fromString(css: string) {
let root = postcss.parse(css)
return new Stylesheet(root)
}
static async fromRoot(root: postcss.Root, file?: string) {
return new Stylesheet(root, file)
}
constructor(root: postcss.Root, file?: string) {
this.id = Math.random().toString(36).slice(2)
Domain
Source
Frequently Asked Questions
What is the Stylesheet class?
Stylesheet is a class in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/stylesheet.ts.
Where is Stylesheet defined?
Stylesheet is defined in packages/@tailwindcss-upgrade/src/stylesheet.ts at line 18.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free