-
I am having trouble building the css with the CLI tool. I get a warning when building the css about the
I have a suspicion that the config file or File structure:
tailwindcss.config.js
./src/tailwind-in.css
I am very lost. I'd appreciate any assistance available. Edit |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments 22 replies
-
Hey! Your content path is wrong, you’re missing a slash: module.exports = {
- content: [".src/**/*.{html,js}"],
+ content: ["./src/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [],
} |
Beta Was this translation helpful? Give feedback.
-
I was able to resolve the problem. Here is the working code.
|
Beta Was this translation helpful? Give feedback.
-
this error is just because of And classes get automatically added in output file as soon as you will use them in html file. |
Beta Was this translation helpful? Give feedback.
-
I tried all the above, but none worked. I had to use const { join } = require('path');
module.exports = {
content: [join(__dirname, 'src/**/*.{js,ts,jsx,tsx}')],
theme: {
extend: {},
},
plugins: [],
}; |
Beta Was this translation helpful? Give feedback.
-
The content section of your tailwind.config.js file is where you configure the paths to all of your HTML templates, JavaScript components, and any other source files that contain Tailwind class names. module.exports = { |
Beta Was this translation helpful? Give feedback.
-
Mine is only broken in production I wonder if it's related to Next.js Edit: it was because I had an unusual setup with Next.js being served through Nest.js |
Beta Was this translation helpful? Give feedback.
-
Make sure, you place both the index.html and input.css file in the src file as instructed in the installation guidelines. |
Beta Was this translation helpful? Give feedback.
-
In my case, I has everything setup but had not used any tailwind class. I tried the aforementioned with no success. But once I used a tailwind class, all was well. |
Beta Was this translation helpful? Give feedback.
-
The solution is actually quite simple. Your content paths should point to your HTML files that make use of the tailwind utility classes. You could either move your HTML files to the src folder or add paths to your HTML files in the content section like so: /** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js}",
"./*.{html,js}"],
theme: {
extend: {},
},
plugins: [],
} The second path in the content section above points to HTML and JS files in the main parent folder. Also, your HTML file should contain some utility classes otherwise the error would persist, so throw some utility classes into your HTML to prevent the error from occurring. Don't forget to link your output CSS file to the HTML file. |
Beta Was this translation helpful? Give feedback.
-
maybe document should be update https://tailwindcss.com/docs/guides/vite#vue 🤣 |
Beta Was this translation helpful? Give feedback.
-
In my case I had my project in sub directories I solved like this: //tailwind.config.js content: ["./src/**/*.{htm,html,js}"], // package.json "scripts": {
"tailwindcss": "cd test/demo && npx tailwindcss -i ./src/css/input.css -o ./src/build/output.css --watch",
}, cd test/demo && npx tailwindcss -i ./src/css/input.css -o ./src/css/output.css --watch |
Beta Was this translation helpful? Give feedback.
-
None of above was working in my project so i Try this and it worked |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
If there are no Tailwind utility classes in your files, Tailwind will generate this warning. Add some basic utility classes to test:
|
Beta Was this translation helpful? Give feedback.
I was able to resolve the problem. Here is the working code.