0

I'm using postcss & postcss-scss for a codemod and don't want it to touch comments, but everything I try converts them into block comments.

example:

const postcssScss = require('postcss-scss');
const postcss = require('postcss')

const scss = `div {
  padding: 0; // comment
}`;

postcss().process(scss, {syntax: postcssScss}).then(result => {
  const node = result.root.nodes[0].nodes[0];
  node.assign({prop: 'spacing'})
  console.log(result.root.toString())
})

result:

div {
  spacing: 0; /* comment*/
}

desired:

div {
  spacing: 0; // comment
}
  • @rayhatfield -- I'm perfectly aware of that, postscss has the ability to format output, and postcss-scss can supposedly do this based on the github issues –  Jul 06 '22 at 20:42
  • Check https://stackoverflow.com/questions/46774659/how-to-support-inline-comments-in-postcss – James Jul 06 '22 at 21:00

0 Answers0