Try right-clicking on the browser's refresh button and select empty cache and reload.
Feb 14, 2021
8
Level 1
Laravel doesn't load Tailwind styles
Laravel doesn't load Tailwind styles on a fresh installation.
I installed Tailwind via NPM and created my config file tailwind.config.js
module.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
I added the following code to my resources/app.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Also, my webpack.mix.js file looks like this
mix.js("resources/js/app.js", "public/js")
.postCss("resources/css/app.css", "public/css", [
require("tailwindcss"),
]);
I also included the stylesheet in my main layout
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
I didn't get any errors when running
npm install
npm run dev
Let's say I created a simple div like this
<div class ="bg-red-500">
...
</div>
The code will be loaded but the class won't be applied to my div.
Level 122
use your browser network dev tools and make sure that your css is loaded
Look at the css file and make sure it contains the tailwind classes
1 like
Please or to participate in this conversation.