MCPcopy Create free account
hub / github.com/bigcommerce/stencil-cli / run

Method run

lib/nodeSass/UndefinedVariableFixer.js:5–11  ·  view source on GitHub ↗
(errorMessage)

Source from the content-addressed store, hash-verified

3
4class UndefinedVariableFixer extends BaseFixer {
5 async run(errorMessage) {
6 const varName = this.getUndefinedVariableName(errorMessage);
7 const value = await this.guessVariableValue(varName);
8 const scss = fs.readFileSync(this.filePath, 'utf8');
9 const processedFile = await this.processCss(scss, this.transform(varName, value));
10 return [{ filePath: this.filePath, data: processedFile.css }];
11 }
12
13 getUndefinedVariableName(errorMessage) {
14 const match = errorMessage.match(/\$[a-zA-Z_-]+/gi);

Callers 1

tryToFixMethod · 0.95

Calls 4

guessVariableValueMethod · 0.95
transformMethod · 0.95
processCssMethod · 0.80

Tested by

no test coverage detected