Action to use HTMLMinifier on Github Actions
Add the following step to your workflow file, just before deploying your HTML files.
- uses: emepetres/html-minifier-action@v1
Optional Path to root directory containing HTML files. Default "."
.
Optional Prints minification details. Default false
.
Optional Minify CSS in style elements and style attributes. Default true
.
Optional Minify JavaScript in script elements and event attributes. Default true
.
Optional Additional flags to pass to HTMLMinifier, separted by comma. See docs. Use ! to indicate false value of a flag..
The files minified, relative to repository root.
- name: HTMLMinifier
uses: emepetres/html-minifier-action@v1
id: html-minifier
with:
rootDir: "src"
verbose: true
flags: "collapseWhitespace, removeComments, removeOptionalTags, removeRedundantAttributes, removeScriptTypeAttributes, removeTagWhitespace, useShortDoctype, removeAttributeQuotes"
- name: Get the minfied files from output
run: echo "The files minfied are ${{ steps.html-minifier.outputs.minifiedFiles }}"