Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

un minify JS (javascript) code using visual studio?

I am able to Un minify CSS using Visual studio shortcut (Ctrl + K + D). Same trick not working for JS files.

How can I un minify JS using Visual Studio like (Ctrl + K + D) short cut. I know there are lot of tools on web but i am searching for Visual Studio.

like image 696
sridharnetha Avatar asked Jul 25 '14 15:07

sridharnetha


People also ask

How do I un minify a JavaScript file?

You can't unminify a minified file. Minification is a desctructive operation and involves loss of information. For example, if you have a function with a descriptive name, after minifcation that name will be substitute with a meaningless one. There's no way to go back from this operation.

How do I minify a file in Visual Studio?

bundleconfig.json To minify any JavaScript, CSS or HTML file, right click on that file in solution explorer and select Bundling & Minifier >> Minify File. It will create a [filename]. min. [extension].


2 Answers

Tool to Unminify / Decompress JavaScript

You cannot truly unminify javascript, as minified javascript replaces variable names with letters, as well as removing code comments - these cannot be "undone" as the original information no longer exists.

It appears that you can at least recreate appropriate spacing, but "real" minified javascript cannot be undone.

like image 71
Kritner Avatar answered Sep 29 '22 12:09

Kritner


You can use Prettier https://prettier.io/docs/en/install.html, to get the script slightly human readable.

If you are having problem with vs code you can add this in your settings.json

"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },

It works for me for mega file...

like image 40
FATCHOLA Avatar answered Sep 29 '22 13:09

FATCHOLA