如何从缩小的javascript文件中获取源代码? [英] How can i get source from a minified javascript file?

查看:95
本文介绍了如何从缩小的javascript文件中获取源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在线YUI压缩器来缩小我的javascript文件...现在我得到它的缩小版本但我丢失了源代码,因为我上传了源javascript文件而没有复制它...

I used online YUI Compressor for minifying my javascript file... Now i got minified version of it but i lost the source as i uploaded the source javascript file without taking a copy of it...


  • 如何从缩小的javascript文件中获取源代码?

推荐答案

你必须努力工作,但作为一个起点,我建议你重新格式化并重新编写代码,有一些工具可以做到:

You will have to work hard, but as a starting point I would recommend you to reformat and reindent the code, there are out there some tools to do it:

  • JavaScript unpacker and beautifier
  • JavaScript Beautifier

正如我所说的那样,你会给出一个起点,你需要很好地了解代码才能正确地重命名变量和函数。

That as I said, will give you a starting point, you will need to know the code well to rename your variables and functions properly.

最后一个选项是考虑重写,如果你确切知道你的脚本是什么意思做,可以花费更少的时间而不是重构缩小的来源......

The last option would be to consider a rewrite, which if you know exactly what your script is meant to do, can take less time than refactoring the minified source...

最后但并非最不重要的是我建议你去工作始终使用版本控制系统并经常进行备份......

And at last but not least I would recommend you to work always with a version control system and do backups often...

这篇关于如何从缩小的javascript文件中获取源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆