HTML, CSS, JavaScript
Recommendation for VS Code CSS extension
Gravatar is a globally recognized avatar based on your email address. Recommendation for VS Code CSS extension
  Richard Kaye
  All
  Nov 11, 2021 @ 05:43pm

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

Gravatar is a globally recognized avatar based on your email address. re: Recommendation for VS Code CSS extension
  Rick Strahl
  Richard Kaye
  Nov 11, 2021 @ 07:31pm

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 ---

Gravatar is a globally recognized avatar based on your email address. re: Recommendation for VS Code CSS extension
  Richard Kaye
  Rick Strahl
  Nov 12, 2021 @ 05:09am

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?

Gravatar is a globally recognized avatar based on your email address. re: Recommendation for VS Code CSS extension
  Rick Strahl
  Richard Kaye
  Nov 12, 2021 @ 02:03pm

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 ---

© 1996-2021