Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dernasherbrezon/fingerprint-maven-plugin
Maven plugin for web resources optimization
https://github.com/dernasherbrezon/fingerprint-maven-plugin
html-minification java jsp nginx optimization web
Last synced: 4 days ago
JSON representation
Maven plugin for web resources optimization
- Host: GitHub
- URL: https://github.com/dernasherbrezon/fingerprint-maven-plugin
- Owner: dernasherbrezon
- Created: 2013-05-23T07:29:12.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-08-25T21:29:48.000Z (about 1 year ago)
- Last Synced: 2024-05-02T05:09:17.429Z (7 months ago)
- Topics: html-minification, java, jsp, nginx, optimization, web
- Language: Java
- Homepage:
- Size: 201 KB
- Stars: 7
- Watchers: 3
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
fingerprint-maven-plugin [![Main Workflow](https://github.com/dernasherbrezon/fingerprint-maven-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/dernasherbrezon/fingerprint-maven-plugin/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com.aerse.maven%3Afingerprint-maven-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=com.aerse.maven%3Afingerprint-maven-plugin)
========================Fingerprint and optimize web resources.
About
---------------------This plugin performs several optimizations:
* Resource fingerprinting.
* JS/CSS minification. yuicompressor is used
* HTML minification.
### FingerprintingDuring this process plugin calculates file checksum and prepends it to the file name. All links to this filename will be changed to the fingerprinted version. Original file will be deleted. Fingerprinting used to improve web resource caching. If file checksum is not changed, then the name will be the same and it is safe to add max expires header. Once file contents are changed, checksum will be changed as well. This plugin filters out (recursivly) source directory, detects any resources using the patterns below and copy result (if needed) to the target directory.
The following patterns are used to detect resources eligible for fingerprinting:
* `]+href=["'](.*?)["'][^>]*>`
* `["']([^\s]*?\.js)["']`
* `]+src=["'](.*?)["'][^>]+>`
* `url\(\s*["']?(.*?)["']?\s*\)`
* `]+value="(.*?)"[^>]+>`After fingerprinting it is safe to add max expires header.
Requirements
* All resources should have absolute paths:
* Valid: ``
* Invalid: ``
* JSP contextPath is supported:
* Valid: ``
* Invalid: ``
* All resources should point to existing files without any pre-processing:
* Valid: ``
* Invalid: `/img/test.png"`
* Invalid: `
com.aerse.maven
fingerprint-maven-plugin
3.6
package
generate
://
//
data:
${basedir}/target/webcombined
${basedir}/target/optimized-webapp
true
true
true
html
jsp
tag
html
jsp
tag
css
js
${cdn}
[hash][name].[ext]
```
* Configure apache or nginx with max expires header. The following example is the configuration for nginx:```xml
location ~ ^/.+\.(ico|jpg|jpeg|gif|pdf|jar|png|js|css|txt|epf|ttf|svg|woff)$ {
root ;
expires max;
add_header Cache-Control public;
}
```