doCompileStyle() — vue Function Reference
Architecture documentation for the doCompileStyle() function in compileStyle.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD a8e4176a_85a7_66ad_a2b0_98c89cfc57f1["doCompileStyle()"] 79dccaa4_b8b1_b853_f202_4f6616d93500["compileStyle()"] 79dccaa4_b8b1_b853_f202_4f6616d93500 -->|calls| a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 fb028434_bc65_c2ac_b5e4_53d10153fd9b["compileStyleAsync()"] fb028434_bc65_c2ac_b5e4_53d10153fd9b -->|calls| a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 fcf1d6b1_3e3f_4998_362f_d01ac73af13c["preprocess()"] a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 -->|calls| fcf1d6b1_3e3f_4998_362f_d01ac73af13c 6d0c1bb9_8891_e648_20f9_17e9dfeb6607["cssVarsPlugin()"] a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 -->|calls| 6d0c1bb9_8891_e648_20f9_17e9dfeb6607 2174cd98_3b16_a968_380b_35f7ea8b944e["trimPlugin()"] a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 -->|calls| 2174cd98_3b16_a968_380b_35f7ea8b944e 4b2e229f_d6b9_e76e_db88_f797ff948c08["scopedPlugin()"] a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 -->|calls| 4b2e229f_d6b9_e76e_db88_f797ff948c08 style a8e4176a_85a7_66ad_a2b0_98c89cfc57f1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/compiler-sfc/src/compileStyle.ts lines 49–131
export function doCompileStyle(
options: SFCAsyncStyleCompileOptions
): SFCStyleCompileResults {
const {
filename,
id,
scoped = true,
trim = true,
isProd = false,
preprocessLang,
postcssOptions,
postcssPlugins
} = options
const preprocessor = preprocessLang && processors[preprocessLang]
const preProcessedSource = preprocessor && preprocess(options, preprocessor)
const map = preProcessedSource ? preProcessedSource.map : options.map
const source = preProcessedSource ? preProcessedSource.code : options.source
const plugins = (postcssPlugins || []).slice()
plugins.unshift(cssVarsPlugin({ id: id.replace(/^data-v-/, ''), isProd }))
if (trim) {
plugins.push(trimPlugin())
}
if (scoped) {
plugins.push(scopedPlugin(id))
}
const postCSSOptions: ProcessOptions = {
...postcssOptions,
to: filename,
from: filename
}
if (map) {
postCSSOptions.map = {
inline: false,
annotation: false,
prev: map
}
}
let result, code, outMap
const errors: any[] = []
if (preProcessedSource && preProcessedSource.errors.length) {
errors.push(...preProcessedSource.errors)
}
try {
result = postcss(plugins).process(source, postCSSOptions)
// In async mode, return a promise.
if (options.isAsync) {
return result
.then(
(result: LazyResult): SFCStyleCompileResults => ({
code: result.css || '',
map: result.map && result.map.toJSON(),
errors,
rawResult: result
})
)
.catch(
(error: Error): SFCStyleCompileResults => ({
code: '',
map: undefined,
errors: [...errors, error.message],
rawResult: undefined
})
)
}
// force synchronous transform (we know we only have sync plugins)
code = result.css
outMap = result.map
} catch (e) {
errors.push(e)
}
return {
code: code || ``,
map: outMap && outMap.toJSON(),
errors,
rawResult: result
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does doCompileStyle() do?
doCompileStyle() is a function in the vue codebase.
What does doCompileStyle() call?
doCompileStyle() calls 4 function(s): cssVarsPlugin, preprocess, scopedPlugin, trimPlugin.
What calls doCompileStyle()?
doCompileStyle() is called by 2 function(s): compileStyle, compileStyleAsync.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free