/html-minifier-action

Action to use html-minifier on Github Actions

Primary LanguageJavaScriptMIT LicenseMIT

HTMLMinifier Action

GitHub release MIT license PRs Welcome

Action to use HTMLMinifier on Github Actions

Usage

Add the following step to your workflow file, just before deploying your HTML files.

- uses: emepetres/html-minifier-action@v1

Inputs

rootDir

Optional Path to root directory containing HTML files. Default ".".

verbose

Optional Prints minification details. Default false.

minifyCSS

Optional Minify CSS in style elements and style attributes. Default true.

minifyJS

Optional Minify JavaScript in script elements and event attributes. Default true.

flags

Optional Additional flags to pass to HTMLMinifier, separted by comma. See docs. Use ! to indicate false value of a flag..

Outputs

minifiedFiles

The files minified, relative to repository root.

Example usage

- 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 }}"