Replies: 13 comments 42 replies
-
I realised I'm having the same problem and I'm not even using the sass preprocessor. @nckrtl Have you ever found a solution to this issue? |
Beta Was this translation helpful? Give feedback.
-
Hi @estevanmaito, Watch task running times:
Windows 10, Node 12.13.1
If you're still willing to inspect/debug this, it can be downloaded here: |
Beta Was this translation helpful? Give feedback.
-
I am also seeing this issue. I did a test of a barebones build and was still seeing build times around 5-6 seconds. tailwind.csss
Webpack.mix
This resulted in |
Beta Was this translation helpful? Give feedback.
-
Hi @estevanmaito, Also to the benefit of others here that were struggling like me with unacceptable compiling times, I'm happy to report it can be solved by installing the laravel-mix-purgecss plugin. It would seem unrelated My initial building time went from 41s down to 12s and my compiling times went from 24s to 8s on Linux (and 4.5s on Win10). Last thing I'm still interested to test is if Laravel Mix v6 will fix this issue. If not, maybe this issue should be reported to them to be fixed ahead of shipping v6. Has anyone tried it? |
Beta Was this translation helpful? Give feedback.
-
@jaxtheking it seems, seems to be true. Order yourself a pizza or something, treat yourself to something. That really will improve my life. <3 my build went from ~30s to ~10s required were these parts - install purgecss (example here is untested) - be sure to check @jaxtheking link, he has the infos there
example webpack.mix.js const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix
.purgeCss({
enabled: true, //mix.inProduction(),
content: [
'./resources/views/**/*.blade.php',
'./resources/js/**/*.js',
'./resources/js/**/*.jsx',
'./resources/js/**/*.tsx',
]
})
.sass('resources/sass/tailwind.scss', 'public/css')
.options({
processCssUrls: false,
postCss: [
,tailwindcss('tailwind.config.js') ],
}); I wonder though how useful this is for dev? as when one adds new tailwind classes, are they built as well? |
Beta Was this translation helpful? Give feedback.
-
@jossnaz Running Purge in dev is adding unnecessary overhead. As suggested above, splitting files makes a huge improvement. I use styles.css with the usual Tailwind import EXCEPT
Here, I’m using Postcss, but it should work with SASS as well. My guess is that since Note that all 3 CSS files (the two build files and the combined file) will be added to |
Beta Was this translation helpful? Give feedback.
-
actually disabling tailwindcss can lead to a problem in the mix file, e.g. it gets removed as well. an alternative would be to build it separately |
Beta Was this translation helpful? Give feedback.
-
Is there a way to disable mix css asset compilation on hot reload? The fact is we can compile tailwind css only once and the it almost never change during the app development. And if it changes, we just we just run |
Beta Was this translation helpful? Give feedback.
-
@nckrtl it may interest you: https://nystudio107.com/blog/speeding-up-tailwind-css-builds |
Beta Was this translation helpful? Give feedback.
-
This solution doesn't work anymore because Tailwind cannot find classes when using Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Alright, this issue just got solved for good: https://www.youtube.com/watch?v=3O_3X7InOw8 hold on to your freaking hats because mine just got blown away completely 🤯. |
Beta Was this translation helpful? Give feedback.
-
Putting tailwind imports in a separate file worked for me , compile time went from |
Beta Was this translation helpful? Give feedback.
-
Hi, I was stuck with slow performance too, working on a big project, compiling time was about 7/8 seconds per component, I've disabled many of the variants that I don't use (almost all of them, since I use @apply + media query all the time) and now compiling time is back to 1 second :) |
Beta Was this translation helpful? Give feedback.
-
Im trying to optimize the performance of npm watch. Currently each scss file change will take about 4400ms to be compiled. It only happens to style sheets, for example VueJS file changes are like 300ms.
I noticed that when I remove sourcemaps support in my webpack.mix.js file the compile times get slashed by a half, resulting in 2200ms on average. Although sourcemaps are beneficial I could live without them (my projects aren't that complex).
A bit more investigation lead me to my app.scss which looks like:
When I leave out the tailwind utilities my compile times for scss files are down to 300ms. Unfortunately I then lose everything tailwindcss is about; the utilities. So what I'm wondering:
Is 4000ms per compilation with npm run watch normal?
If not, what can I try to improve it?
Any help is welcome, Nick
This is my current webpack.mix.js:
This is what my package.json looks like:
Beta Was this translation helpful? Give feedback.
All reactions