Commit 7654f45c authored by Matija Obreza's avatar Matija Obreza

Minify, aggregate and compress CSS and JS

Use theme 'one' for single minified css+js, 'dev' for non-minified
parent fbf9b1a4
......@@ -541,6 +541,7 @@
<configuration>
<jswarn>false</jswarn>
<force>true</force>
<gzip>true</gzip>
<suffix>.min</suffix>
<excludes>
<exclude>**/*.min.js</exclude>
......@@ -563,6 +564,16 @@
<include>crophub.min.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/js/all.min.js</output>
<includes>
<include>jquery.min.js</include>
<include>bootstrap.min.js</include>
<include>tab.min.js</include>
<include>crophub.min.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
......@@ -570,6 +581,7 @@
<includes>
<include>${basedir}/src/main/webapp/html/css/custom.css</include>
<include>${basedir}/src/main/webapp/html/css/responsive.css</include>
<include>${basedir}/src/main/webapp/html/css/forza.css</include>
</includes>
</aggregation>
<aggregation>
......@@ -578,6 +590,18 @@
<includes>
<include>custom.min.css</include>
<include>responsive.min.css</include>
<include>forza.min.css</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/css/all.min.css</output>
<includes>
<include>bootstrap.min.css</include>
<include>jquery-ui.min.css</include>
<include>custom.min.css</include>
<include>responsive.min.css</include>
<include>forza.min.css</include>
</includes>
</aggregation>
</aggregations>
......
......@@ -68,6 +68,7 @@
</list>
</property>
<property name="redirectHttp10Compatible" value="false" />
<property name="requestContextAttribute" value="requestContext"/>
</bean>
<!--Handle common exceptions-->
......@@ -95,6 +96,8 @@
</bean>
<!-- Stick user to view -->
<bean class="org.genesys2.spring.AddStuffInterceptor" />
<!-- theme interceptor -->
<ref bean="themeChangeInterceptor" />
</mvc:interceptors>
<!--Locale resolver-->
......@@ -116,4 +119,13 @@
</property>
</bean>
<!-- Theme Change Interceptor and Resolver definition -->
<bean id="themeChangeInterceptor"
class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
<property name="paramName" value="theme" />
</bean>
<bean id="themeResolver"
class="org.springframework.web.servlet.theme.CookieThemeResolver">
<property name="defaultThemeName" value="${theme.defaultThemeName}" />
</bean>
</beans>
......@@ -99,3 +99,6 @@ hazelcast.aws.access-key=
hazelcast.aws.secret-key=
hazelcast.aws.region=eu-west-1
hazelcast.aws.security-group=sg-hazelcast
# Theme
theme.defaultThemeName=dev
......@@ -12,16 +12,30 @@
<title><sitemesh:write property="title" /></title>
<!-- Bootstrap core CSS -->
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<!-- Custom styles for this template -->
<!-- <link href="<c:url value="/html/css/genesys.min.css" />" rel="stylesheet" /> -->
<c:choose>
<c:when test="${requestContext.theme.name eq 'one'}">
<link href="<c:url value="/html/css/all.min.css" />" rel="stylesheet" />
</c:when>
<c:when test="${requestContext.theme.name eq 'all-min'}">
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/genesys.min.css" />" rel="stylesheet" />
</c:when>
<c:when test="${requestContext.theme.name eq 'all'}">
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/genesys.css" />" rel="stylesheet" />
</c:when>
<c:otherwise>
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/custom.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/responsive.css" />" rel="stylesheet" />
<link href="<c:url value="/html/font/forza.css" />" rel="stylesheet" />
</c:otherwise>
</c:choose>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
......
......@@ -36,11 +36,29 @@
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<c:choose>
<c:when test="${requestContext.theme.name eq 'one'}">
<script type="text/javascript" src="/html/js/all.min.js"></script>
</c:when>
<c:when test="${requestContext.theme.name eq 'all-min'}">
<script type="text/javascript" src="/html/js/jquery.min.js"></script>
<script type="text/javascript" src="/html/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/html/js/genesys.min.js"></script>
</c:when>
<c:when test="${requestContext.theme.name eq 'all'}">
<script type="text/javascript" src="/html/js/jquery.min.js"></script>
<script type="text/javascript" src="/html/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/html/js/genesys.js"></script>
</c:when>
<c:otherwise>
<script type="text/javascript" src="/html/js/jquery.min.js"></script>
<script type="text/javascript" src="/html/js/bootstrap.min.js"></script>
<!-- <script type="text/javascript" src="/html/js/genesys.min.js"></script> -->
<script type="text/javascript" src="/html/js/tab.js"></script>
<script type="text/javascript" src="/html/js/crophub.js"></script>
</c:otherwise>
</c:choose>
<script type="text/javascript">
$( document ).ready(function() {
$('#news a').click(function (e) {
......
......@@ -15,15 +15,29 @@
<title><sitemesh:write property="title" /></title>
<!-- Bootstrap core CSS -->
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<!-- Custom styles for this template -->
<!-- <link href="<c:url value="/html/css/genesys.min.css" />" rel="stylesheet" /> -->
<c:choose>
<c:when test="${requestContext.theme.name eq 'one'}">
<link href="<c:url value="/html/css/all.min.css" />" rel="stylesheet" />
</c:when>
<c:when test="${requestContext.theme.name eq 'all-min'}">
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/genesys.min.css" />" rel="stylesheet" />
</c:when>
<c:when test="${requestContext.theme.name eq 'all'}">
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/genesys.css" />" rel="stylesheet" />
</c:when>
<c:otherwise>
<link href="<c:url value="/html/css/bootstrap.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/jquery-ui.min.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/custom.css" />" rel="stylesheet" />
<link href="<c:url value="/html/css/responsive.css" />" rel="stylesheet" />
<link href="<c:url value="/html/font/forza.css" />" rel="stylesheet" />
</c:otherwise>
</c:choose>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
......
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on January 14, 2014 */
@font-face {
font-family: 'forzabook';
src: url('../fonts/forza-book-webfont.eot');
src: url('../fonts/forza-book-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/forza-book-webfont.woff') format('woff'),
url('../fonts/forza-book-webfont.ttf') format('truetype'),
url('../fonts/forza-book-webfont.svg#forzabook') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'forzamedium';
src: url('../fonts/forza-medium-webfont.eot');
src: url('../fonts/forza-medium-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/forza-medium-webfont.woff') format('woff'),
url('../fonts/forza-medium-webfont.ttf') format('truetype'),
url('../fonts/forza-medium-webfont.svg#forzamedium') format('svg');
font-weight: normal;
font-style: normal;
}
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on January 14, 2014 */
@font-face {
font-family: 'forzabook';
src: url('forza-book-webfont.eot');
src: url('forza-book-webfont.eot?#iefix') format('embedded-opentype'),
url('forza-book-webfont.woff') format('woff'),
url('forza-book-webfont.ttf') format('truetype'),
url('forza-book-webfont.svg#forzabook') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'forzamedium';
src: url('forza-medium-webfont.eot');
src: url('forza-medium-webfont.eot?#iefix') format('embedded-opentype'),
url('forza-medium-webfont.woff') format('woff'),
url('forza-medium-webfont.ttf') format('truetype'),
url('forza-medium-webfont.svg#forzamedium') format('svg');
font-weight: normal;
font-style: normal;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment