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
  f2317e5f_7a5e_90e5_813e_5f497d49b943["styleBlockRanges()"]
  0e3e8c5a_e3ef_6c0d_8a31_e358e2206f79["is-safe-migration.ts"]
  f2317e5f_7a5e_90e5_813e_5f497d49b943 -->|defined in| 0e3e8c5a_e3ef_6c0d_8a31_e358e2206f79
  style f2317e5f_7a5e_90e5_813e_5f497d49b943 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