https://github.com/evemilano/theme_comparator
This Python script is designed to help developers and designers compare two versions of a WordPress theme. It identifies differences in files, including missing, added, and modified files, and provides a detailed report on the changes. This tool is invaluable for debugging, collaboration, and understanding changes between theme updates.
https://github.com/evemilano/theme_comparator
comparison python seo themes webmaster wordpress
Last synced: about 1 month ago
JSON representation
This Python script is designed to help developers and designers compare two versions of a WordPress theme. It identifies differences in files, including missing, added, and modified files, and provides a detailed report on the changes. This tool is invaluable for debugging, collaboration, and understanding changes between theme updates.
- Host: GitHub
- URL: https://github.com/evemilano/theme_comparator
- Owner: evemilano
- License: gpl-3.0
- Created: 2024-05-28T21:42:07.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-28T21:47:53.000Z (about 2 years ago)
- Last Synced: 2025-08-25T18:44:51.888Z (10 months ago)
- Topics: comparison, python, seo, themes, webmaster, wordpress
- Language: Python
- Homepage: https://www.evemilano.com
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Theme Comparison Script
## Overview
This Python script is designed to help developers and designers compare two versions of a WordPress theme. It identifies differences in files, including missing, added, and modified files, and provides a detailed report on the changes. This tool is invaluable for debugging, collaboration, and understanding changes between theme updates.
## Features
- Extracts ZIP files: Automatically extracts WordPress theme ZIP files for comparison.
- File Comparison: Compares each file in the two themes to identify missing, added, and modified files.
- Detailed Diff Reports: Generates a unified diff report for modified files, showing precise changes at the line level.
- Clear Output: Saves the comparison report with a timestamp and the names of the compared themes for easy reference.
## Use Cases
- Theme Updates: Quickly see what has changed between two versions of a theme.
- Debugging: Identify changes that may have introduced bugs or issues.
- Collaboration: Understand what modifications have been made by team members.
- Optimization: Track changes that affect performance or security.
## Requirements
- Python 3.x
- Standard Python libraries: zipfile, difflib, os, pathlib
## Installation
1. Clone this repository to your local machine.
2. Navigate to the project directory.
## Usage
1. Setup: Create a directory with the following structure:
/
├── script.py
└── input/
├── theme1.zip (or extracted folder theme1)
└── theme2.zip (or extracted folder theme2)
2. Place your themes: Put the two theme ZIP files or extracted folders inside the input directory.
3. Run the script: Execute the script to generate the comparison report.
The script will generate a report file named in the format report__vs__yyyymmdd_hhmm.txt in the same directory as the script.
## Output
The output report includes:
- Missing files: Files present in one theme but missing in the other.
- Added files: Files added in one theme compared to the other.
- Modified files: Detailed differences for files that have been modified, using a unified diff format.
## Example Output
Format of differences:
@@ -a,b +c,d @@
a: Starting line number in the original file
b: Number of lines in the block from the original file
c: Starting line number in the modified file
d: Number of lines in the block from the modified file
-: Lines removed from the original file
+: Lines added to the modified file
Missing files in theme2:
file1.php
file2.css
Added files in theme2:
file3.js
file4.html
Modified file: style.css
--- theme1/style.css
+++ theme2/style.css
@@ -15,7 +15,7 @@
- old line 15
+ new line 15
unchanged line 16
unchanged line 17
unchanged line 18
@@ -25,4 +25,4 @@
- old line 25
+ new line 25
## Contributing
Contributions are welcome! Please fork this repository and submit a pull request for any improvements or bug fixes.
## License
This project is licensed under the MIT License. See the LICENSE file for more details.
## Contact
For any questions or suggestions, please contact [Giovanni Sacheli @ evemilano.com](https://www.evemilano.com).