Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Tailwind JIT

67 sites Security covered Drupal 10–11
View on drupal.org

This module provides Just-in-Time (JIT) compilation for Tailwind CSS in Drupal themes. It dynamically generates minimized CSS based on the styles actually used on each page, resulting in highly optimized stylesheets. The module automatically detects CSS classes from rendered HTML and can be configured to use an executable path for Tailwind CSS.

Provides Just-in-Time compilation of Tailwind CSS for Drupal themes.

Setup

  1. Install and enable the module
  2. Install Tailwind CSS
  3. In your settings.php, create a variable named $settings['tailwind_jit_executable'], containing the path to the Tailwind executable:
    • If you installed the standalone CLI build, the path depends on the location to your downloaded binary and your OS:
      You must either provide an absolute path like
      $settings['tailwind_jit_executable'] = '/usr/bin/tailwindcss-macos-arm64';
      or a path relative to the DRUPAL_ROOT directory (usually /web), e.g.
      $settings['tailwind_jit_executable'] = '../vendor/bin/tailwindcss';
    • If you installed the NodeJS version, the path most likely will be
      $settings['tailwind_jit_executable'] = 'npx tailwindcss';
  4. Go to the theme settings and activate the compiler:
    Appearance => Settings (of your theme) => Section "Tailwind CSS Just-in-time compilation"

Now when you visit your website, the uncompiled CSS input file will be dynamically replaced with a minified Tailwind CSS output. Only those styles that are actually used on a page are included in the output. The result is a perfectly minimized CSS for every single page of your website.

This module can not generate styles for blocks rendered by core's BigPipe module. It is recommended to disable BigPipe if you want to use this module.

FAQ

  • Can I use arbitrary values like pt-[1.2345rem]?
    Yes.
  • Does it work with Views paging or Ajax requests?
    Yes.
  • Can I use it with Layout builder or Paragraphs module?
    Yes, CSS classes rendered by Twig templates will be detected automatically. With the help of an extra module that provides an UI to inject CSS classes (like e.g. Block class or Layout builder styles or Style options module) site builders can even style them on the fly in the admin UI .
  • Can I use it with admin themes?
    Yes. I recommend the Field group module to easily finetune your UI without creating your own subtheme and without any custom code.
    Want two input fields in one line? Create a field group with those two fields below and inject grid grid-cols-2 on the parent container in the node form display.
  • Is the compiled CSS cached?
    Yes. The best performance is achieved if core's "Internal Page Cache" module is enabled and used. If Internal page cache is not applicable, Tailwind JIT itself can optionally cache the compiled CSS in the database.
  • Where do I put my tailwind.config.js and how do I configure the template file paths (the content: [] in the config file)?
    You don't need a tailwind.config.js, the module will automatically provide the current page's HTML as content to the compiler. If you need to add additional custom config, use Tailwind's @config directive inside your input CSS file.
    Note: If you use a custom config file, the content key will be ignored, this key will always be set by the module.
  • Can I use multiple CSS input files or separate input files for individual Drupal libraries?
    No, not by library. By concept Tailwind CSS is designed to work with one CSS input file and will automatically create a purged, minimized CSS depending on page content. But is is possible to define a separate input file for Ajax requests, e.g. one without Tailwind's preflight styles.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
2
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Slowing

Releases

Version Type Core Release date
1.2.0 Stable 10–11 Mar 10, 2025
1.1.2 Stable 10–11 Oct 14, 2024