Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

combat008's avatar

Tailwindcss not working properly when refreshing page on laravel project

When I apply new styles on a page in my project its not getting reflected on the page, if I apply styles that I used previously then they work just fine, npm run watch is running in the background and laravel mix keeps saying webpack compiled successfully but the changes are not being reflected at all, for example if using class="mb-4" works then changing it to class="mb-10" removes the margin completely like it doesn't even exist. What could be the issue here?

0 likes
6 replies
tykus's avatar

Is the Tailwind config correctly specifying where to watch your content

module.exports = {
  content: ["./src/**/*.{html,js}"], // paths to your views
  theme: {
    extend: {},
  },
  plugins: [],
}
combat008's avatar

@tykus My views are kept in resources/views and its subfolders so I think it is correct. It was working previously but quite inconsistently, took multiple refreshes and some time to finally apply the styles, now its completely not working at applying the new styles

module.exports = {
  content: [
    "./resources/**/*.blade.php",
    "./resources/**/*.js",
    "./resources/**/*.vue",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

combat008's avatar

Update: new styles got applied but it took like 5 minutes, its really inconvenient that its not working on first refresh of the page.

tykus's avatar

@combat008 how long is it taking to compile?

    "./resources/**/*.{blade.php,js,vue}"
//    "./resources/**/*.blade.php",
//    "./resources/**/*.js",
//    "./resources/**/*.vue",

Please or to participate in this conversation.