I basically did everything on what the instruction had said BUT it is still not working somehow. I wanted to test out things here and there since I am new at this kind of stuff.
All files
HTML FILE
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="dist/output.css" rel="stylesheet">
<link href="src/input.css" rel="stylesheet">
</head>
<body>
<div class="text-red-400 bg-slate-300 text-xl">
Hello world!
</div>
<div class="bg-slate-600">
Testing
</div>
</body>
</html>
TAILWIND CONFIG FILE
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js}",
"./main/index.html",
"./dist/output.css"
],
theme: {
extend: {},
},
plugins: [],
}
output.css file
json file
the result
2
Answers
Consider checking you have the following in what I assume to be the input file for Tailwind,
src/input.css
:The
dist/output.css
should not be covered by thecontent
file globs:Assuming
src/input.css
is the input file for Tailwind, then it should not be referenced inmain/index.html
.The path referenced for
dist/output.css
seems incorrect inmain/index.html
, it should be../dist/output.css
, if the server servingmain/index.html
serves upper-level folders like this. If the server does not, you may wish to instead move theoutput.css
file tomain/dist/output.css
without changing the original reference path.Then, ensure you run to compile the Tailwind CSS rules:
Try Installing Tailwindcss extension as shown in this snippet.
after installing it reboot the vscode and try it.
Or use this link to install it Tailwincss