Apparently, several workarounds are provided, but how that still remains a myth.
AST after the assessment was absolutely correct, which is as follows:
Element { combinator: { value: '', emptyOrWhitespace: true }, value: '.', index: 54, currentFileInfo: { filename: 'input', relativeUrls: undefined, rootpath: '', currentDirectory: '', entryPath: '', rootFilename: 'input' } }, Element { combinator: { value: '', emptyOrWhitespace: true }, value: Quoted { escaped: undefined, value: 'a', quote: 'a', index: undefined, currentFileInfo: undefined }, index: 55, currentFileInfo: { filename: 'input', relativeUrls: undefined, rootpath: '', currentDirectory: '', entryPath: '', rootFilename: 'input' } }, Element { combinator: { value: '', emptyOrWhitespace: true }, value: '-foo', index: 61, currentFileInfo: { filename: 'input', relativeUrls: undefined, rootpath: '', currentDirectory: '', entryPath: '', rootFilename: 'input' } }
But when you create CSS code, things quickly go south.
Quoted.prototype.genCSS = function (context, output) { if (!this.escaped) { output.add(this.quote, this.currentFileInfo, this.index); } output.add(this.value); if (!this.escaped) { output.add(this.quote); } };
Quoted node will output a value with a quote around it when it is not escaped. Then somehow the quote is the first char value, for example 'a' in this case.
And when applying e() around replace , it will put Anonymous node in AST instead of Quoted node less, so no quote will be output.