Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 w/ Tailwind CSS
#6

Hi,
I am successfully using Tailwind CSS in my CodeIgniter 4 project. If anyone still searching it, then I followed below steps:
Step 1: In the CodeIgniter project folder, run below commands to install node package and create blank tailwind.config.js
Code:
npm install -D tailwindcss

npx tailwindcss init

Step 2: Update tailwind.config.js as below:
Code:
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./app/Views/**/*.php"],
  theme: {
    extend: {},
  },
  plugins: [],
}

Step 3: Create input.css with below code. You can create it anywhere. I created at app > Views > css > input.css
Code:
@tailwind base;
@tailwind components;
@tailwind utilities;

Step 4: On terminal in CodeIgniter project folder, run below command. If you using different path for input.css and output css (mine styles.css) then change path accordingly.
Code:
npx tailwindcss -i ./app/Views/css/input.css -o ./public/assets/css/styles.css --watch

Step 5: Now just include out css file (mine styles.css) in your php files. With Step 4 command, it will keep running, so if you add any tailwind css class in php file, it will automatically add that to output css file.
Hope this helps!
Reply


Messages In This Thread
Codeigniter 4 w/ Tailwind CSS - by rmartin93 - 01-26-2023, 04:34 PM
RE: Codeigniter 4 w/ Tailwind CSS - by InsiteFX - 04-09-2023, 11:28 PM
RE: Codeigniter 4 w/ Tailwind CSS - by kcs - 06-28-2023, 02:19 PM
RE: Codeigniter 4 w/ Tailwind CSS - by Corsari - 06-29-2023, 02:48 AM
RE: Codeigniter 4 w/ Tailwind CSS - by encodedigital - 09-08-2023, 04:03 PM
RE: Codeigniter 4 w/ Tailwind CSS - by Reiji - 01-05-2024, 09:51 AM
RE: Codeigniter 4 w/ Tailwind CSS - by dgvirtual - 01-06-2025, 11:00 AM
RE: Codeigniter 4 w/ Tailwind CSS - by Bosborne - 01-08-2025, 11:09 AM
RE: Codeigniter 4 w/ Tailwind CSS - by dgvirtual - 01-08-2025, 11:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB