F
Filament2mo ago
simon

Minifying JS/CSS assets

I'm trying to work out how to minify my JS and CSS assets in production. I'm using the enlightn package and it flags a number of assets which aren't minified, including both core Filament resources such as public/css/filament/forms/forms.css and public/js/filament/filament/echo.js as well as plugin resources such as public/js/saade/filament-fullcalendar/components/filament-fullcalendar-alpine.js. Running npm run build doesn't minify them and here is my Vite config:
import {
defineConfig
} from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/css/filament/portal/theme.css'
],
refresh: true,
}),
],
build: {
minify: true,
cssMinify: true,
}
});
import {
defineConfig
} from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/css/filament/portal/theme.css'
],
refresh: true,
}),
],
build: {
minify: true,
cssMinify: true,
}
});
Strangely, all of the files are minified in my local environment when running npm run build, just not in my sandbox or production environment. What am I missing?
2 Replies
arnaudsf
arnaudsf2mo ago
couldn't be difference of node version ?
simon
simonOP2mo ago
I've tried different node versions but it's still not minifying the assets.
Want results from more Discord servers?
Add your server