Skip to content

[JIT] mode Tailwind CLI cannot build files in real time. #5753

@ouweiya

Description

@ouweiya

What version of Tailwind CSS are you using?
"tailwindcss": "^2.2.16"

What build tool (or framework if it abstracts the build tool) are you using?
Tailwind CLI v2.2.16,

What version of Node.js are you using?
v14.17.6

What browser are you using?
Chrome

What operating system are you using?
Windows 11

Describe your issue
I used Tailwind CLI to build the file and found a weird problem. I can't tell whether it was a mistake in my operation or a program error.

When I use npx tailwindcss -w, I can output the code correctly in the terminal,
But when using npx tailwindcss -o ./dist/tailwind.css --watch to output to a file in real time, the code will not be updated, it will only be executed once when the command is entered.

tailwind.config.js

module.exports = {
  mode: 'jit',
  purge: ['./index.html'],
  darkMode: false,
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
};

Command Line

npx tailwindcss -o ./dist/tailwind.css --watch

Dependent information

"devDependencies": {
    "autoprefixer": "^10.3.7",
    "postcss": "^8.3.9",
    "tailwindcss": "^2.2.16"
  }

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="shortcut icon" href="#" />
    <link href="./dist/tailwind.css" rel="stylesheet" />
  </head>
  <body>
    <div class="bg-red-300"></div>
  </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions