Minify JS/CSS/HTML [gh-pages branch] #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: minify | |
run-name: Minify JS/CSS/HTML [gh-pages branch] | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
checkout-minify-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- run: npm install -g html-minifier | |
- run: npm install -g csso-cli | |
- run: npm install -g terser | |
- run: for i in ./wedding/*.html; do html-minifier --collapse-boolean-attributes --collapse-whitespace --minify-css --minify-js --minify-urls --remove-attribute-quotes --remove-comments --remove-empty-attributes --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --remove-tag-whitespace --use-short-doctype $i -o $i; done | |
- run: for i in ./wedding/scripts/*.js; do terser $i --compress -o $i; done | |
- run: for i in ./wedding/css/*.css; do csso $i -o $i; done | |
- run: | | |
git config user.name reccho | |
git config user.email [email protected] | |
git commit -am 'Automated minify of ${{ github.sha }}' | |
git push --force -u origin main:gh-pages |