Maven HTMLCompressor Plugin allows to compress HTML/XML files by adding a few lines to the pom file.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.mvn/wrapper
_layouts
src
.gitignore
.travis.yml
KNOWN_ISSUES
LICENSE
NOTICE
README.md
_config.yml
mvnw
mvnw.cmd
pom.xml

README.md

Maven HTMLCompressor Plugin

BuildStatus Mavencentral Apache2

Overview

Maven HTMLCompressor Plugin allows to compress HTML/XML files by adding a few lines to the pom file. This plugin uses htmlcompressor library.

Getting started

The simplest way to start using this plugin is:

1.Enable plugin in your pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>com.tunyk.mvn.plugins.htmlcompressor</groupId>
            <artifactId>htmlcompressor-maven-plugin</artifactId>
            <version>1.4-SNAPSHOT</version>
            <configuration>
                <goalPrefix>htmlcompressor</goalPrefix>
            </configuration>
        </plugin>
    </plugins>
</build>

2.Put XML and HTML files under src/main/resources into any underlying structure as HTMLCompressor will recursively process files

3.For HTML compression, create integration.js file under src/main/resources where html is stored with the contents like below. It will integrate HTML templates into JavaScript (%s will be replaced with JSON object and copied to the target folder).

var htmlTemplatesInjector = {
    htmlTemplates: %s
};

4.Run maven goals:

mvn htmlcompressor:html
mvn htmlcompressor:xml

5.Check the target folder for output where resources are stored.

Here is demo you can download

More information about HTML/XML compression plugin configuration at wiki page:

License

Apache License version 2.0

Issues tracking

Issues tracking is available on GitHub issues

Bug reports, feature requests, and general inquiries welcome.