Which versions of Tailwind and Laravel Mix do you use?
Feb 17, 2021
6
Level 1
Laravel 8 + Tailwind PurgeCSS
I'm trying to deploy an app. I am using mix as configured out of the box.
When I run npm run production
I expect that the app.css file to be purged of extra tailwind classes, but the resulting file is 4.5MB
My webpack.mix.js file looks like:
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel applications. By default, we are compiling the CSS
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js').postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
require('autoprefixer'),
]);
mix.copy('resources/img', 'public/img');
My tailwind.config.js file looks like:
const defaultTheme = require('tailwindcss/defaultTheme');
const colors = require('tailwindcss/colors');
module.exports = {
purge: {
content: [
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php'
]
},
theme: {
extend: {
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
colors: {
lime: colors.lime,
orange: colors.orange
}
},
},
variants: {
extend: {
opacity: ['disabled'],
},
},
plugins: [require('@tailwindcss/forms')],
};
Am I missing something? The app is not very big or complex, so I know I'm not using all 4.5mb of tailwind.
Level 28
module.exports = {
purge: {
enable: true,
content: [
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php'
]
},
try enabling manually and see what happens
1 like
Please or to participate in this conversation.