gios / gzipper

CLI for compressing files.
https://www.npmjs.com/package/gzipper
GNU General Public License v3.0
68 stars 13 forks source link

Additional option --copy-original-files when outputPath is provided #94

Open do-me opened 2 years ago

do-me commented 2 years ago

Thanks a lot for this amazing repo!

I'm currently setting up a GitHub action based on gzipper and noticed that until now, there is no option to simply copy the original files to the (newly created) outputPath directory first. This would come in really handy for immediate deployment however.

Hence I propose --copy-original-files flag for this purpose as a possible enhancement.

If anyone needs a workaround follow these step:

  1. Copy the uncompressed, original files to the compressed-branch
  2. Use this branch as in- and output (in my case gh-pages)

Step 2. can be done like this:

      # check out other branch (gh-pages) 
      - uses: actions/checkout@v2
        with:
          ref: gh-pages

      # compress all files in all directories
      - run: gzipper compress --include htm,html,css,js,svg,xml,map,json,img,png,jpg,jpeg --zopfli --brotli --remove-larger .

      # commit
      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Compress Files
          branch: gh-pages
          push_options: '--force'

Find the full action with mkdocs deploy here.