Why does this error occur ?
When specified content path in the tailwind.config.css
doesn't have any html/js
file
OR
if you are not using tailwind-css classes
in your html
file
module.exports = {
content: ["./src/**/*.{html,js}"], π Your html and js files which is users of tailwind classes
theme: {
extend: {},
},
plugins: [],
};
This states I want to use the tailwind classes for html/js
files under src
directory. But src doesn't have any html/js
file.
Solution:
- Change
content
in tailwind.config.css
to have right path
- Have
html/js
files in the specified directory.
Extra : Proper approach to follow when using Tailwind-CLI
1. Know about your file structure. Use:
public
|_ tailwind_base.css
π File from which the output.css is produced
@tailwind base;
@tailwind components;
@tailwind utilities;
|_ output.css
src
|_ index.html
π Link with the output.css using
<link href="../public/output.css" rel="stylesheet" />
Watch it as
npx tailwindcss -i ./public/tailwind_base.css -o ./public/output.css --watch
Specify your html/js
in tailwind.config.js
module.exports = {
content: ["./src/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [],
};
index.html file
<html lang="en">
<head>
<link href="../public/output.css" rel="stylesheet" />
</head>
<body class="text-8xl">
Hello
</body>
</html>
Use tailwindcss classes
happily in your index.html
file π
src
directory β Telekinesis