Skip to content

Instantly share code, notes, and snippets.

@banterCZ
Created January 28, 2013 20:11
Show Gist options
  • Save banterCZ/4658592 to your computer and use it in GitHub Desktop.
Save banterCZ/4658592 to your computer and use it in GitHub Desktop.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Minification sample</title>
<c:choose>
<c:when test="${environment == 'development'}">
<link rel="stylesheet" href="<c:url value="/gui/css/first.css" />" />
<link rel="stylesheet" href="<c:url value="/gui/css/second.css" />" />
</c:when>
<c:otherwise>
<link rel="stylesheet" href="<c:url value="/gui/css/minified.${version}.css" />" />
</c:otherwise>
</c:choose>
</head>
<body>
<h1>Minification sample</h1>
<button id="button1">Button 1</button>
<button id="button2">Button 2</button>
<script type="text/javascript" src="<c:url value="/gui/js/jquery-1.9.0.min.js" />"></script>
<c:choose>
<c:when test="${environment == 'development'}">
<script type="text/javascript" src="<c:url value="/gui/js/custom_script1.js" />"></script>
<script type="text/javascript" src="<c:url value="/gui/js/custom_script2.js" />"></script>
</c:when>
<c:otherwise>
<script type="text/javascript" src="<c:url value="/gui/js/minified.${version}.js" />"></script>
</c:otherwise>
</c:choose>
</body>
</html>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<jswarn>false</jswarn>
<suffix>.min</suffix>
<aggregations>
<aggregation>
<output>
${project.build.directory}/${project.build.finalName}/gui/js/minified.${version}.js
</output>
<includes>
<include>**/custom_script1.min.js</include>
<include>**/custom_script2.min.js</include>
</includes>
</aggregation>
<aggregation>
<output>
${project.build.directory}/${project.build.finalName}/gui/css/minified.${version}.css
</output>
<includes>
<include>**/*.min.css</include>
</includes>
</aggregation>
</aggregations>
</configuration>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment