简体   繁体   English

Dreamweaver扩展来美化PHP / JavaScript / jQuery代码

[英]Dreamweaver extension to beautify PHP/JavaScript/jQuery code

I'm looking so long for a Dreamweaver extension to auto beautify PHP / JavaScript / jQuery code. 我正在寻找一个Dreamweaver扩展来自动美化PHP / JavaScript / jQuery代码。 Currently Dreamweaver can beautify only HTML and CSS (Apply Source Formatting). 目前,Dreamweaver只能美化HTML和CSS(应用源格式)。

Any kind of help will be much appreciated. 任何形式的帮助将不胜感激。

Online solutions for validation and formatting JavaScript: 验证和格式化JavaScript的在线解决方案:

Validate JavaScript code:
http://www.javascriptlint.com/

Format JavaScript code:
http://jsbeautifier.org/

You can use PhpEdit, it's an extra debugger! 你可以使用PhpEdit,它是一个额外的调试器!
DW doesn't do debug, you find the error if and only if you run your code. DW不执行调试,当且仅当您运行代码时才会发现错误。

With PhpEdit, it is onTime. 使用PhpEdit,它是onTime。

For the PHP side of things use https://github.com/fabpot/PHP-CS-Fixer 对于PHP方面的事情,请使用https://github.com/fabpot/PHP-CS-Fixer

This short excerpt and more information is taken from the README. 这篇简短的摘录和更多信息来自README。

Installation: 安装:

Download the php-cs-fixer.phar file and store it somewhere on your computer. 下载php-cs-fixer.phar文件并将其存储在计算机上的某个位置。

Usage: 用法:

The fix command tries to fix as much coding standards problems as possible on a given file or directory: fix命令尝试在给定文件或目录上修复尽可能多的编码标准问题:

 php php-cs-fixer.phar fix /path/to/dir php php-cs-fixer.phar fix /path/to/file 

I have found this great dreamweaver extenstion, just give it a try 我发现这个伟大的Dreamweaver扩展,只是尝试一下

Their Homepage: http://www.decodize.com/projects/ 他们的主页: http//www.decodize.com/projects/

extension download page: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=2107536 扩展下载页面: http//www.adobe.com/cfusion/exchange/index.cfm?event = extendDetail&loc = en_us& extid = 2107536

Maybe try http://www.javascriptlint.com/ says it works on some IDEs, maybe DW is one of them. 也许试试http://www.javascriptlint.com/说它适用于某些IDE,也许DW就是其中之一。

Try googling, but use 'code format' not 'beautify' 尝试谷歌搜索,但使用'代码格式'而不是'美化'

I was wondering if you could elaborate on how to set this up. 我想知道你是否可以详细说明如何设置它。 I see the CSS and Tag Libraries options under "Advanced Formatting", but I am stuck at that point as to how to get my PHP to start auto-indenting. 我在“高级格式化”下看到了CSS和标签库选项,但我仍然坚持如何让我的PHP开始自动缩进。

Or, if Dreamweaver has somehow fixed this problem, let me know! 或者,如果Dreamweaver以某种方式解决了这个问题,请告诉我! It seems like every other IDE has an auto-indent feature! 似乎每个其他IDE都有一个自动缩进功能! Thanks :) 谢谢 :)

Best way i found is to set the way Dreamweaver displays code yourself. 我发现的最佳方法是设置Dreamweaver自己显示代码的方式。 Sure it takes some time to do but its worth it. 当然需要一些时间才能做到但值得。

Here is how: 方法如下:

Dreamweaver: Edit > Preferences > Code Format Dreamweaver:编辑>首选项>代码格式

Then under Advanced Formatting you can pick CSS... or Tag Libraries... 然后在高级格式化下,您可以选择CSS ...或标签库...

You can make any of your code look as it should this way. 您可以按照这种方式使任何代码看起来像这样。

Like i said, will take some time but do it once and you can keep using it with all your future Dreamweaver versions. 就像我说的,将需要一些时间,但只需要做一次,你可以继续使用它与你未来的所有Dreamweaver版本。

It's been a while since I have used DW, I use Aptana now and there is an option to format the code from one of the drop down menus. 自从我使用DW以来已经有一段时间了,我现在使用Aptana,并且可以选择从下拉菜单中的一个格式化代码。 Just use something like "control a" (To select all your code), "control f" (To format your code). 只需使用“控制a”(选择所有代码),“控制f”(格式化代码)。 There might be another key combination but I think this will work if memory serves. 可能还有另一个关键组合,但我认为如果内存服务,这将有效。

Maybe "esc control f" 也许“esc控制f”

I've not seen anything for Dreamweaver, but if you can copy ans paste the code, http://jsbeautifier.org/ can help you with making code look a good bit better. 我没有看到Dreamweaver的任何内容,但如果您可以复制和粘贴代码, http://jsbeautifier.org/可以帮助您使代码看起来更好一些。 I've just tried it on some packed JavaScript and it worked out very well. 我刚刚在一些打包的JavaScript上尝试过,它运行得非常好。 You can also download the application and run it locally (it's only HTML and JavaScript), so you won't need an internet connection to get your code prettier. 您也可以下载该应用程序并在本地运行它(它只是HTML和JavaScript),因此您不需要互联网连接即可让您的代码更漂亮。

In Dreamweaver CS6 no need any other extension or tools. 在Dreamweaver CS6中,无需任何其他扩展或工具。 Just select your code and then Go to 'Commands' > 'Apply Source Formatting' or 'Apply Source Formatting to Selection' 只需选择您的代码,然后转到“命令”>“应用源格式”或“将源格式应用于选择”

Done. 完成。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM