sindresorhus / gulp-zip

ZIP compress files
MIT License
270 stars 47 forks source link

Fonts are corrupting #123

Open bilalmalkoc opened 3 months ago

bilalmalkoc commented 3 months ago

When bundle my app with gulp-zip, fonts getting corrupted. I am fixing this by uploading fonts as manually.

Here is my gulpfile.mjs

import rename from 'gulp-rename'
import gulp from 'gulp'
import gulpZip from 'gulp-zip'
import { homedir } from 'os'

const userHomeDirectory = homedir()
const desktopDir = `${userHomeDirectory}/Desktop`

const pluginFolder = 'production'

export const zip = () => {
  return gulp
    .src(
      [
        '**/*',
        '!node_modules/**',
        '!src/**',
        '!.browserslistrc',
        '!.eslintrc',
        '!eslint.config.mjs',
        '!.prettierrc',
        '!.stylelintrc.json',
        '!gulpfile.js',
        '!gulpfile.mjs',
        '!postcss.config.js',
        '!phpcs.xml.dist',
        '!package.json',
        '!composer.json',
        '!composer.lock',
        '!package-lock.json',
        '!webpack.config.js',
        '!.DS_Store',
        '!README.md',
        '!.idea/**',
        '!.github/**',
        '!.git/**',
        '!**/*.css.map',
        '!**/*.js.map',
      ],
    )
    .pipe(
      rename(function (path) {
        path.dirname = `${pluginFolder}/${path.dirname}`
      })
    )
    .pipe(gulpZip(`${pluginFolder}.zip`, { compress: true }))
    .pipe(gulp.dest(desktopDir))
}

Also tried compress: false. Still same problem.

brokeboiflex commented 2 months ago

Images are corrupted also

j-oliveras commented 2 months ago

I had the same issue with binary files.

I think this is caused by Gulp 5 breaking change "Default stream encoding to UTF-8". I solved it adding encoding: false on gulp.src options (second parameter).

brokeboiflex commented 2 months ago

I had the same issue with binary files.

I think this is caused by Gulp 5 breaking change "Default stream encoding to UTF-8". I solved it adding encoding: false on gulp.src options (second parameter).

Fixes the issue for me