question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown utility "bg-sky-800" in Twind

See original GitHub issue

Hello,

I upgraded to version 1.1 and start getting this error (was not present in last version):

Screenshot 2022-09-26 185254

my twind.config.ts:

import { Options } from "$fresh/plugins/twind.ts";
import * as colors from "twind/colors";

export default {
  selfURL: import.meta.url,
  darkMode: "class",
  mode: "silent",
  theme: {
    extend: {
      colors,
    },
  },
} as Options;
deno 1.25.0 (release, x86_64-pc-windows-msvc)
v8 10.6.194.5
typescript 4.7.4

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kitsonkcommented, Nov 3, 2022

Yes, the comment here gives the workaround: https://github.com/tw-in-js/vscode-twind-intellisense/issues/18#issuecomment-1264023267 but it isn’t totally clear in the details.

On the latest version of fresh what you need to do is:

  • remove selfUrl from /twind.config.ts

  • remove the import of Options from $fresh/plugins/twind.ts.

  • apply a type to the default export via JSDoc like this:

    /** @type {Omit<import("$fresh/plugins/twind.ts").Options, "selfURL">} */
    
  • Modify the start arguments in main.ts to look like this:

    await start(manifest, {
      plugins: [twindPlugin({
        selfURL: new URL("./twind.config.ts", import.meta.url).href,
        ...twindConfig,
      })],
    });
    

Then configuration changes to the /twind.config.ts should be reflected in the intellisense in the plugin (at least they have for me).

What appears to be going on is that when the fresh twind gets pulled in, it is “overriding” the inferred types that the vscode-twind-intellisense gets from the twind config, meaning only “built in” values are checked. By excluding the hard import and using the JSDoc “type import” it seems to free up the plugin to properly infer the config.

I am not totally sure how easy it would be to make this the default @lucacasonato. I might take a look later, but it does seem to be a bit of a friction point and seems to be a common pattern to adjust your twind config.

1reaction
mooxlcommented, Sep 27, 2022
This happens to all custom theme values. Screenshot 2022-09-27 at 10 20 17
It seems that the default theme is always used for linting and intellisense, even though it has been overwritten. Screenshot 2022-09-27 at 10 20 46
deno 1.25.4 (release, aarch64-apple-darwin)
v8 10.7.193.3
typescript 4.7.4
Read more comments on GitHub >

github_iconTop Results From Across the Web

baby bags for twins - Amazon.com
Diaper Bag Backpack, Lepito Expandable Extra Large Capacity Baby Travel Bag Pack, Big Nappy Organizer for Twins, Waterproof Mommy Bag, with Convertible Dry...
Read more >
10 Best Diaper Bag Backpacks for Parents of Twins
Diaper bag backpacks are a must-have for twin parents who have to carry two of everything. Check out our list of the 10...
Read more >
Bags - Minnesota Twins - MLB Shop
Shop for Minnesota Twins bags at the official online store of Major League Baseball. Browse a wide selection of Twins backpacks, luggage, handbags, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found