Serve Minified Assets

Currently, all the Anvil assets including theme.css, Native Libraries, etc. are unminified. This is a waste of resources and results in longer loading times for Apps.

On the other hand, it would have been much faster if the files returned were minified. I can minify files on my own too but that would mean that every time I had to make a change in them, I would have to unminify them, make the changes and minify them again. But if Anvil would do that job for you, things will be much easier.

And maybe, if they want to take things a step forward, the python files can also be minified (up to a certain extent) as Python Minifier ( does.


Does minification preserve line numbers? (Helpful for diagnosing unexpected Exceptions…)

1 Like

Thanks for pointing it out. I realized that minification of Python files might not be a good idea since tracebacks will not be possible.

But I will still request that Anvil continues with the minification of HTML, CSS, and JS files since they have no tracebacks anyway.


An option to minify the Python code may still make sense, once the App’s bugs are worked out.

For one thing, it will likely speed up initial loads. It may also discourage some browser users from casually tampering with the Python code…


I’d like to see several options.

One to minify only when not running in the IDE.

Some for what to minify (e.g. Javascript, CSS, Python, etc)


What is the percentage of loading time that would be gained by minifying ?

That’s something that cannot be predicted. Minifying will squeeze everything into a single line and remove any extra spaces and comments. This will vary for every file depending on how much extra space they have lying around. For me, I saw a 25% reduction in my theme.css file size after minification.

1 Like

As an addition to it, can we also have GZIP text compression? PageSpeed Insights estimates a huge decrease in loading time after implementing it.


When the recent newsletter claimed a reduced time in loading websites, it got me curious. Looks like the change they made was to serve websites using GZIP text compression and the speed is indeed noticeable.