Skip to content

Update/prevent corruption for filesToCopy files while bundling#882

Merged
robruiz merged 2 commits intowprig:developfrom
skywardpro:update/prevent-corruption-for-filesToCopy-files
Aug 31, 2025
Merged

Update/prevent corruption for filesToCopy files while bundling#882
robruiz merged 2 commits intowprig:developfrom
skywardpro:update/prevent-corruption-for-filesToCopy-files

Conversation

@skywardpro
Copy link
Contributor

Description

After bundling some files become corrupted.
During the investigation it was found that:

  1. Images copied via the dedicated images task (which processes assets/images/src/*) work correctly.
  2. Files copied via the prodPrep task (which handles the filesToCopy array from your config, including screenshot.png) get corrupted.
    The issue was found and described here: Corrupted files in bundled theme. #879

Addresses issue #
My solution is to replace the Gulp stream logic in prodPrep.js with the manual Node.js fs stream logic. This bypasses the problematic Gulp handling specifically for the files listed in filesToCopy.

List of changes

  • Bug fix: prevent corruption for images, fonts, videos files when copy them through the filesToCopy part in theme config file

Checklist:

  • This pull request relates to a ticket.
  • This code is tested.
  • This change has been added to CHANGELOG.md
  • I want my code added to WP Rig.

@skywardpro skywardpro requested a review from robruiz as a code owner April 16, 2025 07:48
@skywardpro skywardpro changed the title Update/prevent corruption for files to copy files Update/prevent corruption for filesToCopy files while bundling Apr 16, 2025
@robruiz
Copy link
Contributor

robruiz commented Aug 5, 2025

@skywardpro - I already created a fix for this and it is in the develop branch. If could test that branch out and ensure the problem no longer exists on that branch, I would deeply appreciate it. Thank you.

@skywardpro
Copy link
Contributor Author

@skywardpro - I already created a fix for this and it is in the develop branch. If could test that branch out and ensure the problem no longer exists on that branch, I would deeply appreciate it. Thank you.

Hey! We tested and mostly it works, but when it copies videos - they are still broken

Tested with following formats:
✅ Raster Images (.jpg, .png)
✅ Vector (.svg)
✅ Fonts (.ttf)
🟥 Videos (.mp4)

@robruiz robruiz changed the base branch from master to develop August 31, 2025 14:26
Copy link
Contributor

@robruiz robruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an interesting solve. Going to merge into develop and test there. Thank you.

@robruiz robruiz merged commit 83977bb into wprig:develop Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants