devatherock / minify-js

Minify html, javascript and css files.

Home Page:https://github.com/marketplace/actions/html-css-js-minifier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircleCI Version Codacy Badge Docker Pulls Docker Image Size License: MIT

Minify-JS Github Action/CI Plugin

Github action/CI Plugin to minify html, javascript and css files, using minify.

Usage

Github Action

The following parameters can be set to configure the action.

  • directory - File to minify or a folder containing files to minify. By default, all files in current folder and its sub-folders will be minified

  • output - Path where the minified files will be saved. By default, the minified files will be saved in the original file path

  • add_suffix - Indicates if the output files should have the suffix .min added after the name. Default is true

  • inclusions - Multi-line string, each line of which contains a regex representing files/paths within the input directory to include/minify. By default, all files in the input directory will be minified

jobs:
  build:
    runs-on: ubuntu-latest      # Docker-based github actions have to run on a linux environment
    steps:
      - name: HTML/CSS/JS Minifier
        uses: docker://devatherock/minify-js:3.0.0
        with:
          directory: 'src'      # Optional
          output: 'minify/src'  # Optional
          add_suffix: false     # Optional
          inclusions: |-        # Optional
            .*assets.*
            .*static/index.html

Docker

docker run --rm \
  -v "/path/to/files":/work \
  -w=/work \
  -e PARAMETER_INPUT_PATH=/work/src \
  -e PARAMETER_OUTPUT_PATH=/work/minify/src \
  -e PARAMETER_ADD_SUFFIX=false \
  -e PARAMETER_INCLUSIONS=".*assets.*\n.*static/index.html" \
  devatherock/minify-js:3.0.0

vela

The following parameters can be set to configure the plugin.

  • input_path - File to minify or a folder containing files to minify. By default, all files in current folder and its sub-folders will be minified

  • output_path - Path where the minified files will be saved. By default, the minified files will be saved in the original file path

  • add_suffix - Indicates if the output files should have the suffix .min added after the name. Default is true

  • inclusions - Multi-line string, each line of which contains a regex representing files to include/minify. By default, all files in the input directory will be minified

steps:
  - name: minify_js
    ruleset:
      branch: master
      event: push
    image: devatherock/minify-js:3.0.0
    parameters:
      input_path: src
      output_path: minify/src
      add_suffix: false
      inclusions: |-
        .*assets.*
        .*static/index.html

CircleCI

version: 2.1
jobs:
  minify_js:
    docker:
      - image: devatherock/minify-js:3.0.0
    working_directory: ~/my-repo
    environment:
      PARAMETER_INPUT_PATH: src
      PARAMETER_OUTPUT_PATH: minify/src
      PARAMETER_ADD_SUFFIX: false
      PARAMETER_INCLUSIONS: '.*assets.*\n.*static/index.html'
    steps:
      - checkout
      - run: node /app/bin/cli.mjs

Tests

To test the latest plugin image, run the below command

./gradlew test

About

Minify html, javascript and css files.

https://github.com/marketplace/actions/html-css-js-minifier

License:MIT License


Languages

Language:Groovy 70.6%Language:JavaScript 25.9%Language:Makefile 1.1%Language:HTML 1.0%Language:Dockerfile 0.8%Language:CSS 0.6%