MCPcopy
hub / github.com/vuejs/core / less

Function less

packages/compiler-sfc/src/style/preprocessors.ts:85–115  ·  view source on GitHub ↗
(source, map, options, load = require)

Source from the content-addressed store, hash-verified

83
84// .less
85const less: StylePreprocessor = (source, map, options, load = require) => {
86 const nodeLess = load('less')
87
88 let result: any
89 let error: Error | null = null
90 nodeLess.render(
91 getSource(source, options.filename, options.additionalData),
92 { ...options, syncImport: true },
93 (err: Error | null, output: any) => {
94 error = err
95 result = output
96 },
97 )
98
99 if (error) return { code: '', errors: [error], dependencies: [] }
100 const dependencies = result.imports
101 if (map) {
102 return {
103 code: result.css.toString(),
104 map: merge(map, result.map),
105 errors: [],
106 dependencies: dependencies,
107 }
108 }
109
110 return {
111 code: result.css.toString(),
112 errors: [],
113 dependencies: dependencies,
114 }
115}
116
117// .styl
118const styl: StylePreprocessor = (source, map, options, load = require) => {

Callers

nothing calls this directly

Calls 4

getSourceFunction · 0.85
renderMethod · 0.80
toStringMethod · 0.80
loadFunction · 0.50

Tested by

no test coverage detected