43081j / postcss-lit

PostCSS syntax for extracting CSS from template literals inside JS/TS files
84 stars 6 forks source link

Expressions inside values are not mapped back to their original source #7

Closed 43081j closed 1 year ago

43081j commented 2 years ago
css`
  .foo {
    color: ${expr}hotpink;
  }
`;

this becomes:

  .foo {
    color: /*POSTCSS_LIT:0*/hotpink;
  }

you'd think postcss would pick that up as a comment, but it doesn't.

we end up with a declaration which has a between string of : /*POSTCSS_LIT:0*/. this means our stringifier doesn't pick it up as a special comment and doesn't replace it with the original expression.

It may be that using a comment as the placeholder isn't the best method, or we just ignore these edge cases...