Git Product home page Git Product logo

html-minification-maven-plugin's Introduction

html-minification-maven-plugin

A simple HTML minification plugin to be used in maven projects during build process. Build over serg472/htmlcompressor library, this plugin provides an easy to use plugin based configuration of the library so that simultaneous minification of html files become possible during build process only. Honestly speaking , this was a requirement in my current project.

Usage

Below code provides a simple plugin code fragment to be placed in your pom.xml file to make this code work.

....
<plugin>
  <groupId>com.htmlminifier</groupId>
  <artifactId>html-maven-plugin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>html-minifier</goal>
        </goals>
      </execution>
   </executions>
   <configuration>
     <source-folder>src/main/java/html</source-folder> <!-- required field -->
     <target-folder>src/main/java/minified-html</target-folder> <!-- required field -->
     <walk-recursively>false</walk-recursively> <!-- required field -->
     <compression-enabled>true</compression-enabled> <!-- required field -->
   </configuration>
</plugin>
....

Advanced Options

Optional configuration parameters (Example contains default values) -

....
<configuration>
  ...
  <remove-multispaces>true</remove-multispaces>
  <remove-intertag-spaces>true</remove-intertag-spaces>
  <remove-quotes>true</remove-quotes>
  <simplify-doctype>true</simplify-doctype>
  <remove-script-attrs>false</remove-script-attrs>
  <remove-style-attrs>false</remove-style-attrs>
  <remove-link-attrs>false</remove-link-attrs>
  <remove-form-attrs>false</remove-form-attrs>
  <remove-input-attrs>false</remove-input-attrs>
  <remove-javascript-protocol>false</remove-javascript-protocol>
  <remove-http-protocol>true</remove-http-protocol>
  <remove-https-protocol>true</remove-https-protocol>
  <preserve-original-linebreaks>false</preserve-original-linebreaks>
  <minify-css>true</minify-css>
  <minify-js>true</minify-js>
</configuration>
....

Notes

Currently, the plugin isn't there for public access on Maven repo. In the meantime, one can clone and locally build the jar of the project and use it as a beta release. Do post any issues found in plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.