0

I can't get Tailwind to properly setup. The answers provided in this similar question all did nothing for me, so I'm not sure what I'm doing wrong.

I ran the command:

npx tailwindcss -i AD-WT-22s2-AT2-Pt1/src/tailwind-main.css -o AD-WT-22s2-AT2-Pt1/assets/css/tailwind.css --watch

and I'm fairly certain I've set the config up right.

content: [
  "./src/**/*.{html,js,ts,jsx,tsx}",
  "./**/*.{html,js,ts,jsx,tsx}",
  "./**/*{html, js, jsx, ts, tsx}"
],

The relevant files are:

-main: tailwind-config.js

-src: tailwind-main.css (which contains @tailwind base, @tailwind components and @tailwind utilities)

-assets/css: tailwind.css

  • What is your project structure? I can see your html files are in `src` while css is within `AD...-Pt1/src`. My point is maybe your html/js are actually within `AD-....-Pt1` – Ihar Aliakseyenka Dec 06 '22 at 19:10
  • Yeah someone else helped me out with it and yeah, it was a problem with my config file AND my file structure. – MuseOfSalzburg Dec 09 '22 at 09:35

2 Answers2

0

maybe you have forgotten to link Tailwind's file in your index.html:

like:

    <link href="/dist/output.css" rel="stylesheet">

<!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">
</head>
<body>
  <h1 class="text-3xl font-bold underline">
    Hello world!
  </h1>
</body>
</html>
PiotrDev
  • 1
  • 1
  • No, not that. I’ve got someone in person looking at it now and they reckon my file structures a bit wonky, so we’ll see if they can figure anything out – MuseOfSalzburg Dec 06 '22 at 11:39
0

Turns out there was some problems with one of the node modules and my package.json file should be in the root folder, so I deleted the node modules folder, moved the package.json file to the root, then did an npm reinstall and that did the trick