Home / Function/ styl() — vue Function Reference

styl() — vue Function Reference

Architecture documentation for the styl() function in stylePreprocessors.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  f71c7656_db97_684d_d13f_65f35d0da49b["styl()"]
  496757ba_5cd7_a57b_2bda_c9d4086a452e["stylePreprocessors.ts"]
  f71c7656_db97_684d_d13f_65f35d0da49b -->|defined in| 496757ba_5cd7_a57b_2bda_c9d4086a452e
  style f71c7656_db97_684d_d13f_65f35d0da49b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/compiler-sfc/src/stylePreprocessors.ts lines 91–113

const styl: StylePreprocessor = (source, map, options) => {
  const nodeStylus = require('stylus')
  try {
    const ref = nodeStylus(source)
    Object.keys(options).forEach(key => ref.set(key, options[key]))
    if (map) ref.set('sourcemap', { inline: false, comment: false })

    const result = ref.render()
    const dependencies = ref.deps()
    if (map) {
      return {
        code: result,
        map: merge(map, ref.sourcemap),
        errors: [],
        dependencies
      }
    }

    return { code: result, errors: [], dependencies }
  } catch (e: any) {
    return { code: '', errors: [e], dependencies: [] }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does styl() do?
styl() is a function in the vue codebase, defined in packages/compiler-sfc/src/stylePreprocessors.ts.
Where is styl() defined?
styl() is defined in packages/compiler-sfc/src/stylePreprocessors.ts at line 91.

Analyze Your Own Codebase

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

Try Supermodel Free