Skip to main content
Known Participant
December 19, 2018
Question

DW 2019: Apply Source Formatting of all HTML Files of a Site

  • December 19, 2018
  • 4 replies
  • 2854 views

I want to format the source code of a complete site, of all HTML/PHP/CSS files in all the directories of the site.

How can I do that without opening each file manually and performing the command "Edit > Code > Apply Source Formatting" for each file?

If that is not possible:
What do you think about the idea as a feature for next version of DW?

Thanks.

    This topic has been closed for replies.

    4 replies

    Legend
    December 19, 2018

    Here are the two version of Massimo' sitewide format (one for CC 2015 and one for CC2017 and up: Dropbox  Link

     

    First of all disclaimer: If you intend to try and use these extensions, bare in mind they are old & I would be especially careful on Dreamweaver CC 2017 and up. ***Make a backup of your entire site before using**

     

    On Dreamweaver CC 2015 (it will probably work on CC 2014 but not tested): acccess from Commands > Sitewide > Format Source

     

    On Dreamweaver CC 2017 and up acces from Tools > Sitewide > Format Source

     

    *** PROCEED WITH CAUTION & MAKE A SITE BACKUP BEFORE DOING ANYTHING - IF IT SCREWS UP YOUR FILES ON A LARGE SITE & YOU DO NOT HAVE A BACKUP , YOU MIGHT BE UP ALL NIGHT FIXING IT***

     

    ***Just to reiterate, this is an old extension by Massimo , I'm taking NO credit for somebody elses good work and I just did a small tweak to the extension and repacked it for Dreamweaver CC 2017 and up ***

    Paul-M - Community Expert
    Known Participant
    December 19, 2018

    @Energize

    Thanks a lot. I'm looking forward to test it tomorrow. I will give feedback.

    Legend
    December 19, 2018

    @Energize

    Thanks a lot. I'm looking forward to test it tomorrow. I will give feedback.

    I think it should work fine in Dreamweaver CC 2014 .... Let me know how you get on

    Paul-M - Community Expert
    Legend
    December 19, 2018

    FYI I have tweaked the format source extenion for enitre site to work with CC 2019, it was originally written by Massimo ​who used to write extensions fro Dreamweaver back in the day, so I'm not trying to take credit for anybodys work. I just tweaked the extension to reflect the chnages Adobe have made to Dreamweavers menus.

    I just want to check it works OK (on first inspection it seems to) and I will post a link to download as it doesn;t appear Massimo has links to his extenions anymore with them quite old now.

    Paul-M - Community Expert
    ALsp
    Legend
    December 19, 2018

    it was originally written by Massimo who used to write extensions fro Dreamweaver back in the day,

    One of my favorite people. I love the quote on his home page:

    "Never buy magic! Before you commit to a framework, make sure you could write it. Do this by actually writing something simple that does the basics that you need. Make sure the magic all goes away. And then look at the framework again. Is it worth it? Can you live without it?"  - Bob Martin

    Thanks for the bit of nostalgia.

    Legend
    December 19, 2018

    It can be done in Dreamweaver CC 2015 with the help of an extension. If you want the extension let me know.

    I don't use the format source option in newer versions of DW, it never seems to have worked corectly since some plonker decided it would be a good idea to replace the native code editor in Dreamweaver with Brackets.

    Paul-M - Community Expert
    Jon Fritz
    Community Expert
    Community Expert
    December 19, 2018

    I fear site-wide, automated processes in any version of DW past about CS6. Given a couple of script rewrite bugs in a few of the latest versions that specifically occurred when Apply Source Formatting was run on PHP pages, I don't think I would ever run a site-wide, "no undo available" version of it.

    If every one of those bugs were squashed, and remained that way for more than 1 version, I could see a sitewide ASF being useful to some users.

    Known Participant
    December 19, 2018

    @Jon Fritz

    I think a version control system (I use Git) is a good method to feel safe with side wide processes.

    @Energize

    I'm coming from DW 2014. So I have to fear bugs in the source formatting function in DW 2019.

    Is there a bug entry in the database of Adobe yet?

    If I can use the extension with DW 2014 as well, please let me know where I can find the extension.

    Legend
    December 20, 2018

    @Energizer

    You wrote: "FYI I have tweaked the format source extenion for enitre site to work with CC 2019"

    Did you tested the function yet and do you like to provide that version too?

    Independent of that:

    Did anyone of you ever found a site wide method to tidy code in the more subtle aspects?

    Example:
    <blocklevel-element1> Lorem </blocklevel-element1>

    Tidy:

    <blocklevel-element1>Lorem</blocklevel-element1>

    Sure, you can do that manually with regular expressions.

    But those expressions are huge.
    And you have to make sure, that you get collateral damages like deleting whitespaces inside the element pre. Just as an example.

    I'm looking for a powerful side wide cleaning tool with a GUI, which is able to perform such more ambitious tasks.


    @Energizer

    You wrote: "FYI I have tweaked the format source extenion for enitre site to work with CC 2019"

    Did you tested the function yet and do you like to provide that version too?

    If you look at the dropbox link above there are two versions, one for CC 2015 (and should work in CC 2014) and another version for CC 2017 versions and above.

    I have to say at this point that I do NOT trust the apply source formatting TOOL in CC 2017, CC2018 or CC 2019. There have been lots of documented problems and inconsistencies, (breaking PHP code for example). I have the latest version of CC 2019 and in many cases, the apply souce formatting tool does not obey the rules I have set in Tag LIbraries.

    *** IF YOU INTEND TO TRY AND USE IT WITH DREAMWEAVER CC 2019. I WOULD BE VERY, VERY CAUTIOUS, MAKE A COMPLETRE BACKUP OF YOUR SITE BEFORE USING IT ***

    If you have a CC cloud subscription, I recommend installing Dreamweaver CC 2015 and doing the site wide source format in that version.

    Paul-M - Community Expert