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.

Better DX for using twind, having IDE autocompletions OOTB with VSCode

See original GitHub issue

After generating a new project and answering that I would like to use twind

Do you want to use 'twind' (https://twind.dev/) for styling? [y/N] y

IDE auto completions doesn’t work OOTB.

Considering you’re a VSCode user, there are two other things that need to be added:

  1. Installation of the extension
  2. having a tailwind.config.js or tailwind.config.cjs (see installation)

To solve this, we can consider the following:

  1. use the extensions.json file in order to recommend the tailwind extension. (another point is that we can use this file in order to recommend the deno extension as well)
  2. generate a tailwind.config.js file when choosing the --twind option

If you’ll decide that these are good changes, I’d be happy to contribute

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
timfeecommented, Jul 21, 2022

I worked around this by adding twind.config.ts in my project root:

// ./twind.config.ts
import { Configuration } from 'twind';

export const config: Configuration = {
  darkMode: 'class',
  mode: 'silent',
  theme: {
    extend: {
      fontFamily: {
        'hairline': 'Bungee Hairline',
      },
    },
  },
};

and then importing that in main.ts and in utils/twind.ts:

./utils/twind.ts

import { IS_BROWSER } from '$fresh/runtime.ts';
import { setup } from 'twind';
export * from 'twind';
import { config } from '../twind.config.ts';

if (IS_BROWSER) setup(config);
./main.ts

// snip
import { setup } from '@twind';
import { config } from './twind.config.ts';
// snip

The plugin author says it looks in root, public, src or config – seems like maybe a FR for them would be to allow us to specify custom directories to look for this file (util)

0reactions
ranyitzcommented, Jul 4, 2022

Yes @RileyMShea, I did the same. The idea of this issue is to create this file on project generation, including the relevant annotations to make the autocompletions works OOTB.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliSense in Visual Studio Code
Visual Studio Code IntelliSense is provided for JavaScript, TypeScript, JSON, HTML, CSS, SCSS, and Less out of the box. VS Code supports word...
Read more >
Visual Studio Code and Unity
Unity Development with VS Code. Visual Studio Code can be a great companion to Unity for editing C# files. All of the C#...
Read more >
Visual Studio Code Tips and Tricks
Try out VS Code's code editing features, like multi-cursor editing, IntelliSense, Snippets, Emmet, and many more. Help > Editor Playground. Interactive editor ...
Read more >
TypeScript Programming with Visual Studio Code
ts . This will compile and create a new helloworld.js JavaScript file. compiled hello world. If you have Node.js installed, you ...
Read more >
Java in Visual Studio Code
For a quick walkthrough of editing, running, and debugging a Java program with Visual Studio Code, use the Java Getting Started Tutorial button...
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