nickjj / flask-static-digest

Flask extension to help make your static files production ready by md5 tagging and gzipping them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty print manifest file

reubano opened this issue · comments

It would be nice if there was an option to pretty print the cache_manifest.json file.

Hi,

Do you have a use case in mind where having a pretty printed file is necessary? The file is fully machine generated and expected to be machine read. You never have to think of it as a human.

But if you want to pretty print it you can run this zero dependency Python command to write out a new file that's pretty printed:

python3 -m json.tool path/to/your/cache_manifest.json > path/to/your/pretty_cache_manifest.json

Yes, the use case is being able to inspect the file when debugging or just checking to see what got digested. I can't speak for other frameworks, but this is what the Brunch cache busters do.

In that case there is no option. It pretty prints by default since folks who want to reduce file size will run additional post processing to minimize all js/json files.

Ah, in that case running the above command seems reasonable for occasional debugging? You can also open the file in any major code editor and have it immediately pretty printed by a formatter.

As for minification, this extension is run after you bundle all of your js/css with Webpack, esbuild or whatever tool you prefer. This extension takes those bundles and then digests them as the last step before you decide to serve them in production through a web server or CDN.