File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ name: Deploy to GitHub Pages
22
33on :
44 push :
5- branches : [ master ]
5+ branches : [master]
66 pull_request :
7- branches : [ master ]
7+ branches : [master]
88 workflow_dispatch :
99
1010permissions :
8888
8989 - name : Optimize Assets
9090 run : |
91- html-minifier-terser --input-dir dist --output-dir dist --file-ext html --collapse-whitespace --remove-comments
92- svgo -f dist -r
91+ # HTML Minification
92+ html-minifier-terser \
93+ --input-dir dist \
94+ --output-dir dist \
95+ --file-ext html \
96+ --collapse-whitespace \
97+ --remove-comments \
98+ --remove-redundant-attributes \
99+ --remove-script-type-attributes \
100+ --remove-style-link-type-attributes \
101+ --use-short-doctype \
102+ --minify-css true \
103+ --minify-js true \
104+ || echo "HTML minification failed, continuing..."
105+
106+ # SVG Optimization (only if SVG files exist)
107+ if find dist -name "*.svg" -type f -print -quit | grep -q .; then
108+ svgo -f dist -r
109+ else
110+ echo "No SVG files found to optimize"
111+ fi
93112
94113 - name : Deploy to GitHub Pages
95114 uses : peaceiris/actions-gh-pages@v3
@@ -117,4 +136,4 @@ jobs:
117136 owner: context.repo.owner,
118137 repo: context.repo.repo,
119138 body: message
120- });
139+ });
You can’t perform that action at this time.
0 commit comments