Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Description
Description
Hello there!
I quite like the idea of AssetMapper, but...
I am working on an old PHP monolith with multiple mbs of JS and CSS. We are in the process of porting this app to Symfony and optimising it. As part of this I did some testing with AssetMapper, and though it works great, I've ran into an issue with not being able to minify the JS/CSS.
The problem I am facing specifically is that for us there is a very significant file and performance difference between the minified and non-minified versions of the JS we're serving. That is with gzip compression.
Numbers
On average, depending on the file, the difference is about 25% in terms of file size. And Google Lighthouse does start to yell at me to minify the JS.
Our main JS file has a 50kb difference WITH compression between minifying and not minifying - without compression that would be about 280kb. And that main JS file only represents 1/6 of the total JS in the app spread through various pages.
Also Lighthouse dropped us 15 points instantly.
So I was wondering, can we get an implementation for minification of JS and CSS?
For CSS I can't do any real in-app testing atm, because we use a custom compiler for that to inject values into placeholders - we want to replace that with something else like AssetMapper or webpack or Vite in the future as well.
DISCLAIMER
Yes, I know our JS needs optimising, but I can't really do this in a few days. It's a work in progress, but that'll take time. Right now, for my usecase, and I imagine for other people's as well, being able to minify would solve our issue while allowing us to sort out our JS with the help of AssetMapper.
TL;DR: Can we get minification of JS/CSS and other things supported in AssetMapper?
Example
Something likehttps://github.com/WebGardenGroup/minify-bundle which runs onhttps://github.com/tdewolff/minify
But with more official and guaranteerd support.
Update 27-05-24
We (as a company) currently are implementing Vite usinghttps://symfony-vite.pentatrion.com/
Although I am not a fan of using more 3rd party bundles because of various risks, it does work really well.
Part of the reason we choose Vite over Webpack is that it is becoming the company-wide standard (so we have in-house experts). This will also simplify sharing (Vue/SCSS) assets between our projects, which is a desire by many here. On top of that, many people here are of the opinion that Vite = harder/better/faster/stronger > Webpack.
I do hope the discussion about implementing some kind of minifying+uglifying in AssetMapper will continue, as I am convinced it will be a very important requirement for many others to switch over.