MCPcopy
hub / github.com/less/less.js / toCSS

Method toCSS

packages/less/lib/less/source-map-output.js:114–147  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

112 }
113
114 toCSS(context) {
115 this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });
116
117 if (this._outputSourceFiles) {
118 for (const filename in this._contentsMap) {
119 // eslint-disable-next-line no-prototype-builtins
120 if (this._contentsMap.hasOwnProperty(filename)) {
121 let source = this._contentsMap[filename];
122 if (this._contentsIgnoredCharsMap[filename]) {
123 source = source.slice(this._contentsIgnoredCharsMap[filename]);
124 }
125 this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);
126 }
127 }
128 }
129
130 this._rootNode.genCSS(context, this);
131
132 if (this._css.length > 0) {
133 let sourceMapURL;
134 const sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());
135
136 if (this.sourceMapURL) {
137 sourceMapURL = this.sourceMapURL;
138 } else if (this._sourceMapFilename) {
139 sourceMapURL = this._sourceMapFilename;
140 }
141 this.sourceMapURL = sourceMapURL;
142
143 this.sourceMap = sourceMapContent;
144 }
145
146 return this._css.join('');
147 }
148 }
149
150 return SourceMapOutput;

Callers 1

toCSSMethod · 0.95

Calls 5

normalizeFilenameMethod · 0.95
setSourceContentMethod · 0.80
toJSONMethod · 0.80
joinMethod · 0.65
genCSSMethod · 0.45

Tested by

no test coverage detected