[Ur] Pre-compressing static assets

Adam Chlipala adamc at csail.mit.edu
Tue May 21 11:34:46 EDT 2019


I can't think of a good way to do it with Ur/Web as it stands. It should 
be a pretty simple tweak to the compiler to specify an external program 
to run to transform this JavaScript code.

On 5/21/19 9:05 AM, Simon Van Casteren wrote:
> Hey everybody,
>
> I've been breaking my head today on how to do pre-compression of 
> static assets, mainly the app.*.js bundle. Currently I'm having Nginx 
> do on-the-fly compression using brotli at lvl 4. This causes my 
> app.*.js bundle to shrink from 1.8 MB to 145 kB. This is really good 
> already, but running it at lvl 11 gets me a 90 kB bundle, still 50% 
> less than what I have now! Running it at lvl 11 takes around 5 seconds 
> (on my underpowered server) though, which is really quite long.
>
> In a normal situation I'd run the brotli compressor at build or 
> deployment time, but the app.*.js bundle is never on the filesystem, 
> so I haven't found a way to do this pre-compression in an Ur/Web context.
>
> Anybody has any ideas?
>
> Simon



More information about the Ur mailing list