Open
Description
At the moment we don't perform any checks inside next-yak
if the generated CSS is valid CSS. Until now we relied on the capabilities of Lightning CSS or PostCSS within next.js that do some form of validation.
However we noticed that certain cases like this:
import { styled } from "next-yak";
const MyDiv = styled.div`
&:nth-child(${() => 2}) {
color: red;
}
`;
produce an incorrect CSS:
import { styled } from "next-yak/internal";
import __styleYak from "./index.yak.module.css!=!./index?./index.yak.module.css";
const MyDiv = /*YAK Extracted CSS:
.MyDiv {
&:nth-child(var(--yrRH4Ik)) {
color: red;
}
}
*/ /*#__PURE__*/ styled.div(__styleYak.MyDiv, {
"style": {
"--yrRH4Ik": ()=>2
}
});
that isn't flagged by PostCSS but is flagged by Lightning CSS as invalid CSS.
To improve the error messages and to have a consistent feel (independent if you use Lightning CSS or PostCSS) we should add a validation step after we've generated the CSS within the comments.
What do you think?
Metadata
Assignees
Labels
No labels
Activity