I'm using django-compress to shrink my javascript files. However, I am now having trouble debugging through it because everything is squished. I believe * use some kind of js compression too. How do you go about to debug through your javascript on the live site or on your dev machine with the code well formatted? Firebug has all the code in one line which makes it hard to dig through.
我使用django-compress压缩javascript文件。然而,我现在在调试它时遇到了麻烦,因为所有东西都被压扁了。我认为*也使用了一些js压缩。您如何通过在现场站点上的javascript或在您的dev机器上调试格式化良好的代码?Firebug将所有代码集中在一行中,这使得它很难深入挖掘。
6 个解决方案
#1
8
The simple answer is you don't debug through a compressed file - you use an uncompressed version for development.
简单的答案是,您不需要通过压缩文件进行调试,而是使用未压缩的版本进行开发。
#2
0
Debug before compressing. Compressing and then debugging is way over the line for premature optimization. Just as you would finish developing a C++ program before removing the comments and rename all the variables to be cryptic (that almost no one does this demonstrates just how silly it is).
压缩前调试。压缩然后调试是过早的优化。就像您在删除注释并将所有变量重命名为cryptic之前完成c++程序一样(几乎没有人会这样做,这说明它是多么的愚蠢)。
#3
0
If you are using Google Closure, then there is a plugin that allows you access the unminified version of the code. See the documentation on the Inspector and the source mapping feature.
如果您正在使用谷歌闭包,那么有一个插件允许您访问代码的非缩小版本。请参阅检查器和源映射特性的文档。
#4
0
Some suggestions:
一些建议:
- Don't compress until you deploy to production
- 在部署到生产之前不要压缩。
- Reload your source code after the compress code; it will write over the compressed code
- 在压缩代码之后重新加载源代码;它将在压缩代码上写入
- When it's worth the investment, I take compressed code and manually uncompress it
- 当它值得投资时,我接受压缩代码并手动解压它
#5
0
With IE 11 is pretty simple.
IE 11很简单。
Take a look
看一看
http://dailydotnettips.com/2014/03/03/deminify-the-minified-javascript-easily-in-ie-11/
http://dailydotnettips.com/2014/03/03/deminify-the-minified-javascript-easily-in-ie-11/
#6
-1
I see an answer has already been accepted, but I am adding a new answer since this is the first result I got on Google and think this new info may help someone.
我看到一个答案已经被接受了,但是我正在添加一个新的答案,因为这是我在谷歌上得到的第一个结果,我认为这个新信息可能会对某些人有所帮助。
Some browser DevTools now support Source Maps to map built javascript to is unbuild readable state. You have to minify and/or combine the JS with a tool that supports creating Source Maps. But if you do you can see the original code when debugging the minified/combined javascript.
一些浏览器DevTools现在支持将构建的javascript映射为非构建可读状态。您必须缩小和/或将JS与支持创建源映射的工具结合在一起。但是,如果您在调试minified/组合javascript时可以看到原始代码。
Find more info here: https://developers.google.com/chrome-developer-tools/docs/javascript-debugging#source-maps
在这里可以找到更多的信息:https://developers.google.com/chrome-developer-tools/docs/javascript调试#源映射
#1
8
The simple answer is you don't debug through a compressed file - you use an uncompressed version for development.
简单的答案是,您不需要通过压缩文件进行调试,而是使用未压缩的版本进行开发。
#2
0
Debug before compressing. Compressing and then debugging is way over the line for premature optimization. Just as you would finish developing a C++ program before removing the comments and rename all the variables to be cryptic (that almost no one does this demonstrates just how silly it is).
压缩前调试。压缩然后调试是过早的优化。就像您在删除注释并将所有变量重命名为cryptic之前完成c++程序一样(几乎没有人会这样做,这说明它是多么的愚蠢)。
#3
0
If you are using Google Closure, then there is a plugin that allows you access the unminified version of the code. See the documentation on the Inspector and the source mapping feature.
如果您正在使用谷歌闭包,那么有一个插件允许您访问代码的非缩小版本。请参阅检查器和源映射特性的文档。
#4
0
Some suggestions:
一些建议:
- Don't compress until you deploy to production
- 在部署到生产之前不要压缩。
- Reload your source code after the compress code; it will write over the compressed code
- 在压缩代码之后重新加载源代码;它将在压缩代码上写入
- When it's worth the investment, I take compressed code and manually uncompress it
- 当它值得投资时,我接受压缩代码并手动解压它
#5
0
With IE 11 is pretty simple.
IE 11很简单。
Take a look
看一看
http://dailydotnettips.com/2014/03/03/deminify-the-minified-javascript-easily-in-ie-11/
http://dailydotnettips.com/2014/03/03/deminify-the-minified-javascript-easily-in-ie-11/
#6
-1
I see an answer has already been accepted, but I am adding a new answer since this is the first result I got on Google and think this new info may help someone.
我看到一个答案已经被接受了,但是我正在添加一个新的答案,因为这是我在谷歌上得到的第一个结果,我认为这个新信息可能会对某些人有所帮助。
Some browser DevTools now support Source Maps to map built javascript to is unbuild readable state. You have to minify and/or combine the JS with a tool that supports creating Source Maps. But if you do you can see the original code when debugging the minified/combined javascript.
一些浏览器DevTools现在支持将构建的javascript映射为非构建可读状态。您必须缩小和/或将JS与支持创建源映射的工具结合在一起。但是,如果您在调试minified/组合javascript时可以看到原始代码。
Find more info here: https://developers.google.com/chrome-developer-tools/docs/javascript-debugging#source-maps
在这里可以找到更多的信息:https://developers.google.com/chrome-developer-tools/docs/javascript调试#源映射