This website collects cookies to deliver better user experience
How to use Tailwind CSS in an ExpressJS app.
How to use Tailwind CSS in an ExpressJS app.
This post will guide you if you want to use Tailwind CSS without having to use any bundler.
First use your terminal to change directory to your express application. Then install tailwind in your express app using:
npm i tailwindcss
Run this command to generate the tailwind configuration file. This will create a tailwind.config.js file in your root directory.
npx tailwindcss init
Create a tailwind.css file in your public folder, I would advice you to create a stylesheets folder under the public folder to properly seperate your files(public/stylesheets/tailwind.css). After that copy and paste the following code in the tailwind.css file.
Install postcss globally. This allows us to use postcss in other projects without reinstalling for each projects.
npm install -g postcss-cli
Create a postcss configuration file in your root directory and call it postcss.config.js. Then copy the following configuration into your postcss.config.js file: