MCPcopy
hub / github.com/postcss/postcss / stringify

Method stringify

lib/lazy-result.js:368–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366 }
367
368 stringify() {
369 if (this.error) throw this.error
370 if (this.stringified) return this.result
371 this.stringified = true
372
373 this.sync()
374
375 let opts = this.result.opts
376 let str = stringify
377 if (opts.syntax) str = opts.syntax.stringify
378 if (opts.stringifier) str = opts.stringifier
379 if (str.stringify) str = str.stringify
380
381 let rootSource = this.result.root.source
382 if (
383 opts.map === undefined &&
384 !(rootSource && rootSource.input && rootSource.input.map)
385 ) {
386 let result = ''
387 str(this.result.root, i => {
388 result += i
389 })
390 this.result.css = result
391 return this.result
392 }
393
394 let map = new MapGenerator(str, this.result.root, this.result.opts)
395 let data = map.generate()
396 this.result.css = data[0]
397 this.result.map = data[1]
398
399 return this.result
400 }
401
402 sync() {
403 if (this.error) throw this.error

Callers 14

toResultMethod · 0.95
toResultMethod · 0.95
contentMethod · 0.95
cssMethod · 0.95
mapMethod · 0.95
runAsyncMethod · 0.95
loadMapMethod · 0.45
generateMethod · 0.45
generateStringMethod · 0.45
old-node.jsFile · 0.45
node.test.tsFile · 0.45

Calls 3

syncMethod · 0.95
generateMethod · 0.95
strFunction · 0.85

Tested by 1

stringifyFunction · 0.36