Home > Net >  NexJS Tailwind not loading styles after cloning a github repository
NexJS Tailwind not loading styles after cloning a github repository

Time:12-14

So I'm following a enter image description here

Here's how it should look like:

enter image description here

Am I missing anything? Any commands that I should be running in the terminal? Any help would be appreciated.

CodePudding user response:

Steps you can follow to fix this issue:

  1. Uncomment tailwindcss: {} from postcss.config.js, then re-run your development server.
  2. Completely remove everything, start from scratch, then only copy/import files you need from the started repository.

CodePudding user response:

After hours of fewer induced hallucinations I figured it out. So I found a way on how to fix the Tailwind styles not applying.

  • Clone the last push to GitHub
  • Delete tailwind.config.js | postcss.config.js | package.json | package-lock.json
  • Remake tailwind files and package.json (or in my case copy them from the dude whose project I'm copying)
  • npm i --legacy-peer-deps
  • cd backend (to go to Sanity backend folder)
  • npm i --legacy-peer-deps
  • cd ..
  • Don't forget to comment out tailwindcss: {}, in postcss.config.js as it messes up Sanity
  • npm run dev

So it works now and shows Tailwind CSS applied to the project.

But then, if you git add . there are these errors:

warning: in the working copy of 'package.json', CRLF will be replaced by LF the next time Git touches it

warning: in the working copy of 'postcss.config.js', CRLF will be replaced by LF the next time Git touches it

warning: in the working copy of 'tailwind.config.js', CRLF will be replaced by LF the next time Git touches it

So git reset that.

Found this useful post about the first error. - Git replacing LF with CRLF Basically, it's something dumb that I'm even dumber to understand. But at the end of the post, they linked this answered question here about git add --renormalize . that fixes the issue - Git: how to renormalize line endings in all files in all revisions?

So after doing all the steps above and writing some code, one should run:

  • git add --renormalize . and then git commit -m "Message." There should be no errors like previously this time, and every time you git commit next there shouldn't be any issues (unless you edit the files in question).

I also changed the config autocrlf settings to input from true after reading the first article I linked. Not sure if I should, but I did and the article I followed on how to do it can be found here - How to change line-ending settings

  • Related