I’ve been using TextWrangler (free text editor for Mac) for some time while editing and building WordPress themes.

TextWrangler really shines when it comes to:

  • more complicated single and multi-file search & replace function (such as bulk renaming of MySQL databases on your WordPress installations)
  • opening and saving text files located on remote FTP servers (perfect for real-time template files and CSS adjustments)

Recently, however, I discovered it’s also capable of comparing text files and highlighting the differences between them, plus it’s super easy to do it.

In my early WordPress days I started out by simply modifying existing themes (editing files such as style.css, header.php, footer.php, single.php, functions.php etc.). This prevented being able to update those themes as I would inevitably lose all changes.

This is why I started working with child themes (more on those in my Learn page) and I finally decided to upgrade all of my older sites by building a child theme for each one of them.

Simply browsing through all the files would’ve taken ages, so this is where TextWrangler came in – this is how I did it at least:

1. Open two documents (in my case, style.css in both the original and modified parent theme) that you’d like to compare

2. Click View > Show Files or type CMD + 0. This will open a sidebar with all opened documents.

view-show-files

3. Highlight the 2 files you want to compare in the Documents drawer, right click on them and select the option ‘Compare‘.

text-wrangler-compare

That’s it, TextWrangler will show you exactly which lines were modifed so you can easily copy them into your child theme’s style.css file.

3 Comments

  • I have been wondering how to do this for a while now. The cool thing is that the files don’t have to be saved to make the comparison. You can open two new documents, paste in the text, and run the comparison as you outlined above.

    Thanks!

Leave a Reply