| 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 |