In general, I'm looking for recommendations for a VS Code CSS extension. Specifically, I'm looking for one that can de-minify a CSS file. Actually I guess any file that can be minified I'd like to be able to restore to a more human-friendly form.
TIA
I don't think that's really possible because minifying involves packing names into short hands etc. You may get back some formatting (like this site does) but you still get all the mangled names.
FWIW, you can re-format any document in VS Code using Ctrl-K-F
, but that will basically just work for reformatting white space. And apparently it doesn't work with most minified code.Great for JSON or XML that isn't formatted using Ctrl-A
then Ctrl-K-F
to reformat.
The better approach if you're doing JavaScript development is to use .map
files next to the .min.js
. That will provide source mapping into the source code in the debugger, even into generated languages like Typescript. From there you can actually copy the script if necessary.
+++ Rick ---
Thanks, Rick. It's clearly a n00b question... Sounds like if I have a minified CSS file, there's a source "map" somewhere that is human-readable. 😃
In general terms, are there any CSS or JS extensions you recommend for VS Code?
The source map relies on the source file to map the minified code to the original code. If you have to the original source, you don't need to unminify 😄
Source maps are used for the debugger, so it can figure out lines of code in the original source mapped to a line of code in the minified file.
+++ Rick ---