Home / Function/ styleBlockRanges() — tailwindcss Function Reference

styleBlockRanges() — tailwindcss Function Reference

Architecture documentation for the styleBlockRanges() function in is-safe-migration.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  2166e7b1_4b60_a7b2_d5ba_bba128c5a515["styleBlockRanges()"]
  d5e14c3d_f7c4_162e_96e8_83915119d547["is-safe-migration.ts"]
  2166e7b1_4b60_a7b2_d5ba_bba128c5a515 -->|defined in| d5e14c3d_f7c4_162e_96e8_83915119d547
  style 2166e7b1_4b60_a7b2_d5ba_bba128c5a515 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/is-safe-migration.ts lines 194–215

const styleBlockRanges = new DefaultMap((source: string) => {
  let ranges: number[] = []
  let offset = 0

  while (true) {
    let startTag = source.indexOf('<style', offset)
    if (startTag === -1) return ranges

    offset = startTag + 1

    // Ensure the style looks like:
    // - `<style>`   (closed)
    // - `<style …>` (with attributes)
    if (!source[startTag + 6].match(/[>\s]/)) continue

    let endTag = source.indexOf('</style>', offset)
    if (endTag === -1) return ranges
    offset = endTag + 1

    ranges.push(startTag, endTag)
  }
})

Subdomains

Frequently Asked Questions

What does styleBlockRanges() do?
styleBlockRanges() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/is-safe-migration.ts.
Where is styleBlockRanges() defined?
styleBlockRanges() is defined in packages/@tailwindcss-upgrade/src/codemods/template/is-safe-migration.ts at line 194.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free