Stylesheet Class — tailwindcss Architecture
Architecture documentation for the Stylesheet class in stylesheet.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD c890fa7b_6e17_4e5d_74bf_b797d0f757b8["Stylesheet"] 41fd12a7_15c2_7d83_2e55_c5b9a8faf9b1["stylesheet.ts"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|defined in| 41fd12a7_15c2_7d83_2e55_c5b9a8faf9b1 f5b0b5ff_6cac_8425_61a9_f84aed9ce105["load()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| f5b0b5ff_6cac_8425_61a9_f84aed9ce105 7b77858e_ca4f_a550_ad82_d0815acce8e3["loadSync()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 7b77858e_ca4f_a550_ad82_d0815acce8e3 262b7964_e372_0276_c700_6ecb193a4dad["fromString()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 262b7964_e372_0276_c700_6ecb193a4dad 7f66fb08_0387_a204_8b96_006facd79673["fromRoot()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 7f66fb08_0387_a204_8b96_006facd79673 3091dc1d_2390_d828_8aa0_ef68af32d483["constructor()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 3091dc1d_2390_d828_8aa0_ef68af32d483 354715ed_9cba_87d7_4938_b0974235160c["importRules()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 354715ed_9cba_87d7_4938_b0974235160c 24d2c88e_2e1e_e002_fb88_6a6e41b10158["isEmpty()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 24d2c88e_2e1e_e002_fb88_6a6e41b10158 4d021142_8ab8_64dd_9dd3_89c5a94806be["ancestors()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 4d021142_8ab8_64dd_9dd3_89c5a94806be c95c15d3_40c1_8edb_aa86_c69313b20391["descendants()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| c95c15d3_40c1_8edb_aa86_c69313b20391 541f0913_4821_09d0_f31d_05489c40ddc7["layers()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 541f0913_4821_09d0_f31d_05489c40ddc7 b3bea8bf_aced_dc7a_9ad8_9a35f737e64e["pathsToRoot()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| b3bea8bf_aced_dc7a_9ad8_9a35f737e64e 097a5886_73fc_f3e3_8de2_3a76f018c380["analyzeImportPaths()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 097a5886_73fc_f3e3_8de2_3a76f018c380 1c045add_1dc8_9300_6f23_0eee112704fd["containsRule()"] c890fa7b_6e17_4e5d_74bf_b797d0f757b8 -->|method| 1c045add_1dc8_9300_6f23_0eee112704fd
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