parseImportParams() — tailwindcss Function Reference
Architecture documentation for the parseImportParams() function in at-import.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD ddd2db68_c731_a9de_a974_10945491851d["parseImportParams()"] 6dee7bcb_2b1c_cd79_688e_3f0f0ce8ea8f["migrateImport()"] 6dee7bcb_2b1c_cd79_688e_3f0f0ce8ea8f -->|calls| ddd2db68_c731_a9de_a974_10945491851d 65cd5723_5f2b_da42_e83b_2add05ebc004["substituteAtImports()"] 65cd5723_5f2b_da42_e83b_2add05ebc004 -->|calls| ddd2db68_c731_a9de_a974_10945491851d c57928e0_95f9_bd68_c036_1186e1a4d345["toCss()"] ddd2db68_c731_a9de_a974_10945491851d -->|calls| c57928e0_95f9_bd68_c036_1186e1a4d345 style ddd2db68_c731_a9de_a974_10945491851d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/at-import.ts lines 87–148
export function parseImportParams(params: ValueParser.ValueAstNode[]) {
let uri
let layer: string | null = null
let media: string | null = null
let supports: string | null = null
for (let i = 0; i < params.length; i++) {
let node = params[i]
if (node.kind === 'separator') continue
if (node.kind === 'word' && !uri) {
if (!node.value) return null
if (node.value[0] !== '"' && node.value[0] !== "'") return null
uri = node.value.slice(1, -1)
continue
}
if (node.kind === 'function' && node.value.toLowerCase() === 'url') {
// `@import` with `url(…)` functions are not inlined but skipped and kept
// in the final CSS instead.
// E.g.: `@import url("https://fonts.google.com")`
return null
}
if (!uri) return null
if (
(node.kind === 'word' || node.kind === 'function') &&
node.value.toLowerCase() === 'layer'
) {
if (layer) return null
if (supports) {
throw new Error(
'`layer(…)` in an `@import` should come before any other functions or conditions',
)
}
if ('nodes' in node) {
layer = ValueParser.toCss(node.nodes)
} else {
layer = ''
}
continue
}
if (node.kind === 'function' && node.value.toLowerCase() === 'supports') {
if (supports) return null
supports = ValueParser.toCss(node.nodes)
continue
}
media = ValueParser.toCss(params.slice(i))
break
}
if (!uri) return null
return { uri, layer, media, supports }
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does parseImportParams() do?
parseImportParams() is a function in the tailwindcss codebase.
What does parseImportParams() call?
parseImportParams() calls 1 function(s): toCss.
What calls parseImportParams()?
parseImportParams() is called by 2 function(s): migrateImport, substituteAtImports.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free