Unknown utility "class-name"
For some reason, this...
// components/SidebarIcon.tsx
/** @jsx h */
import { h } from "preact";
export function SidebarIcon(props: {iconName: string}) {
return (
<div className="sidebar-icon">
{props.iconName}
</div>
);
}
...gives me this error from TypeScript in VSCode:
Unknown utility "sidebar-icon" ts(-2020)
I have a feeling that might be caused by Twind because if I use one of its classes — everything is fine. Am I not allowed to create my own classes if I use Twind?
I've just tested with twind and without twind. Both of them not gave me an error.
I understood the source, but not the reason of the issue.
To solve the https://github.com/denoland/fresh/issues/425, I created this file:
// config/twind.config.ts
/** @jsx h */
/** @type {import('twind').Configuration} */
It solved the issue of autocomplete not working for the Twind, but at the same time introduced the above Unknown utillity error. Deleting this config/twind.config.ts file solves the issue, but breaks autocomplete.
This seems like something you'd want to report to the twind folks.
How was this resolved? I'm trying to embed markdown in my site, which otherwise uses tailwind/twind, but I can't figure out how to style it. I get the above error when I try wrap the markdown HTML in my own class. I've looked at a dozen intro-to-Fresh tutorials that use Markdown, and the only ones illustrating style support use gfm. I can't use gfm.
Well, right after I posted the above question, I came up with the following functioning hack:
<>
<Head>
<link rel="stylesheet" href={asset("post.css")} />
</Head>
<article ...>
...
<main
dangerouslySetInnerHTML={{
__html: `<div class='post'>\n${props.post.html}</div>\n`,
}}
/>
</article>
</>