MCPcopy
hub / github.com/postcss/postcss / clearAnnotation

Method clearAnnotation

lib/map-generator.js:65–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 }
64
65 clearAnnotation() {
66 if (this.mapOpts.annotation === false) return
67
68 if (this.root) {
69 let node
70 for (let i = this.root.nodes.length - 1; i >= 0; i--) {
71 node = this.root.nodes[i]
72 if (node.type !== 'comment') continue
73 if (node.text.startsWith('# sourceMappingURL=')) {
74 this.root.removeChild(i)
75 }
76 }
77 } else if (this.css) {
78 let startIndex
79 while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) {
80 let endIndex = this.css.indexOf('*/', startIndex + 3)
81 if (endIndex === -1) break
82 while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
83 startIndex--
84 }
85 this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2)
86 }
87 }
88 }
89
90 generate() {
91 this.clearAnnotation()

Callers 2

constructorMethod · 0.95
generateMethod · 0.95

Calls 1

removeChildMethod · 0.45

Tested by

no test coverage detected