Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2015
    Posts
    1

    Default Prettify code before compare for formats like css js and html.

    Sorry if a duplicate but my search didn't return anything.

    Any way to format files with plugins like CSSTidy or JS-beautify to take care of mostly meaningless differences between the files?

    I do this manually now and it costs a fair amount of time.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,829

    Default

    Hello,

    Yes, although we only have a few specific for download. You can find the Tidy variants we host here:
    http://www.scootersoftware.com/downl..._moreformatsv4

    And we have a KB article for how to define and use any custom command line conversion utility, add it to a File Format, and it will be used automatically whenever you open files with that file format:
    http://www.scootersoftware.com/suppo...rnalconversion
    Aaron P Scooter Software

  3. #3
    Join Date
    Feb 2016
    Posts
    2

    Default

    I've made a new file format to accomplish that. It calls an external batch file that runs the python jsbeautify code.

    Steps:
    1. Download, pip install, or clone the jsbeautify source code from here:
    https://github.com/beautify-web/js-beautify

    2. Install python if you haven't already

    3. Create a new batch file in the Helpers folder (for me on Windows it is in my user folder under AppData\Roaming\Scooter Software\Beyond Compare 4), I called mine jsbeautify.bat

    4. Put the following code into that batch file:
    python C:\yourpath\js-beautify\python\js-beautify -i < %1 > %2

    This will run python on the js-beautify script using the source file as stdin and saving to the target file.

    5. Open Beyond Compare and make a new File Format ("JSBeautify") or copy an existing one which does the following Conversion:
    External program (ANSI)
    Loading:
    Helpers\jsbeautify.bat %s %t

    Make sure it is associated with .js files, and is at the top of your list if you want to override any existing JavaScript file format(s).

    Hope that helps.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •