Skip to content

Commit 32a029d

Browse files
authored
Fix primefaces#12264: XML minification (primefaces#12265)
1 parent eb9e118 commit 32a029d

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

conf/minify.xslt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3+
<xsl:output method="xml" omit-xml-declaration="no" indent="no"/>
4+
5+
<!-- Identity transform -->
6+
<xsl:template match="@*|node()">
7+
<xsl:copy>
8+
<xsl:apply-templates select="@*|node()"/>
9+
</xsl:copy>
10+
</xsl:template>
11+
12+
<!-- Remove whitespace between nodes -->
13+
<xsl:template match="text()[normalize-space()='']"/>
14+
</xsl:stylesheet>

primefaces/pom.xml

+28
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,33 @@
12251225
</dependency>
12261226
</dependencies>
12271227
</plugin>
1228+
<plugin>
1229+
<groupId>org.codehaus.mojo</groupId>
1230+
<artifactId>xml-maven-plugin</artifactId>
1231+
<version>1.1.0</version>
1232+
<executions>
1233+
<execution>
1234+
<id>minify-xml</id>
1235+
<phase>process-resources</phase>
1236+
<goals>
1237+
<goal>transform</goal>
1238+
</goals>
1239+
<configuration>
1240+
<skip>${xml.formatter.skip}</skip>
1241+
<transformationSets>
1242+
<transformationSet>
1243+
<dir>${project.build.directory}/classes/META-INF/</dir>
1244+
<outputDir>${project.build.directory}/classes/META-INF/</outputDir>
1245+
<stylesheet>${project.basedir}/../conf/minify.xslt</stylesheet>
1246+
<includes>
1247+
<include>*.xml</include>
1248+
</includes>
1249+
</transformationSet>
1250+
</transformationSets>
1251+
</configuration>
1252+
</execution>
1253+
</executions>
1254+
</plugin>
12281255
<!-- Rename the copied XML file -->
12291256
<plugin>
12301257
<groupId>org.apache.maven.plugins</groupId>
@@ -1270,6 +1297,7 @@
12701297
<maven.source.skip>true</maven.source.skip>
12711298
<jakarta.jar.skip>false</jakarta.jar.skip>
12721299
<checkstyle.skip>true</checkstyle.skip>
1300+
<xml.formatter.skip>true</xml.formatter.skip>
12731301
<license.skipCheckLicense>true</license.skipCheckLicense>
12741302
<license.skipAddThirdParty>true</license.skipAddThirdParty>
12751303
<license.skipAggregateDownloadLicenses>true</license.skipAggregateDownloadLicenses>

0 commit comments

Comments
 (0)