GoLand 2023.2 Help

Tailwind CSS

GoLand integrates with the Tailwind CSS framework including completion for Tailwind classes in HTML files and completion suggestions for pseudo-class variants, preview of the resulting CSS on hovering over classes in HTML and CSS files or on autocompletion. GoLand recognizes tailwind.config.js files and provides completion based on customization you make to them.

Before you start

  1. Make sure you have Node.js on your computer. Also make sure that your Node.js version complies with the Tailwind CSS requirements. For example, Tailwind CSS v2.0 requires Node.js 12.13 or later. Learn more from the Tailwind CSS Upgrade guide.

  2. Configure a Node.js interpreter in your project as described in Configuring a local Node.js interpreter, or in Using Node.js on Windows Subsystem for Linux, or in Configuring remote Node.js interpreters.

  3. Make sure the CSS bundled plugin is enabled in the Installed tab of the Settings | Plugins page as described in Plugins.

  4. Install and enable the Tailwind CSS plugin on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.

Install Tailwind CSS

  1. Open the embedded Terminal (Alt+F12) .

  2. To install Tailwind CSS, type:

    npm install -D tailwindcss

  3. To generate a configuration file, type:

    npx tailwindcss init

    As result, a tailwind.config.js configuration file is created in the root of your project.

Learn more from the Tailwind CSS official website.

Complete Tailwind classes

GoLand autocompletes Tailwind classes in HTML files and in CSS files after the @apply directive.

Completing Tailwind classes after @apply directive

GoLand suggests Tailwind classes for completion in JavaScript string literals.

Completion for Tailwind classes in JavaScript string literals

Completion suggestions are also shown for pseudo-class variants.

Completion suggestions for pseudo-class variants

Preview the resulting CSS

When you hover over a Tailwind class in an HTML or CSS file, GoLand shows you the preview of the resulting CSS.

The preview is also shown in the Documentation popup (Control+Q) when you complete your code.

Preview the resulting CSS while completing code

Edit your tailwind.config.js

GoLand provides code completion based on the customization you make through your tailwind.config.js configuration files. For example, if you define a custom theme with new colors, newly generated classes with the name of the custom color will be shown in the completion popup.

Completion based on customization in tailwind.config.js

Configure Tailwind options

You can also customize the default Tailwind configuration options. For example, you may want to tune the HTML attributes list for which to provide class completions or use an experimental regular expression format to specify additional places where completions should be triggered.

  1. Open the Settings dialog (Control+Alt+S) and go to Languages and Frameworks | Style Sheets | Tailwind CSS.

  2. Update the properties to add configuration options.

Last modified: 02 August 2023