wro4j für die Zusammenführung und Umwandlung der LESS-Dateien eingeführt
authorKai Moritz <kai@juplo.de>
Tue, 3 Dec 2013 19:52:09 +0000 (20:52 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 19 Jan 2016 16:45:35 +0000 (17:45 +0100)
pom.xml
src/main/webapp/WEB-INF/wro.properties [new file with mode: 0644]
src/main/webapp/WEB-INF/wro.xml [new file with mode: 0644]
src/main/webapp/less/base.less [deleted file]
src/test/resources/jetty-web.xml [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index aae2e13..4f82331 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@
     <slf4j.version>1.5.8</slf4j.version>
     <springframework.version>3.2.4.RELEASE</springframework.version>
     <tiles.version>3.0.1</tiles.version>
+    <wro4j.version>1.7.2</wro4j.version>
 
   </properties>
 
         </configuration>
       </plugin>
       <plugin>
-        <groupId>org.lesscss</groupId>
-        <artifactId>lesscss-maven-plugin</artifactId>
-        <version>1.3.3</version>
+        <groupId>ro.isdc.wro4j</groupId>
+        <artifactId>wro4j-maven-plugin</artifactId>
+        <version>${wro4j.version}</version>
+        <configuration>
+          <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
+          <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/css/</cssDestinationFolder>
+          <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/js/</jsDestinationFolder>
+        </configuration>
         <executions>
           <execution>
+            <phase>prepare-package</phase>
             <goals>
-              <goal>compile</goal>
+              <goal>run</goal>
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <sourceDirectory>${project.basedir}/src/main/webapp/less</sourceDirectory>
-          <outputDirectory>${project.build.directory}/${project.build.finalName}/css</outputDirectory>
-          <compress>true</compress>
-        </configuration>
       </plugin>
       <plugin>
         <artifactId>maven-war-plugin</artifactId>
         <configuration>
-          <warSourceExcludes>less/**</warSourceExcludes>
+          <warSourceExcludes>
+            WEB-INF/wro.*,
+            less/**
+          </warSourceExcludes>
         </configuration>
       </plugin>
       <plugin>
       <plugin>
         <groupId>org.eclipse.jetty</groupId>
         <artifactId>jetty-maven-plugin</artifactId>
+        <configuration>
+          <webApp>
+            <overrideDescriptor>${project.basedir}/src/test/resources/jetty-web.xml</overrideDescriptor>
+          </webApp>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>ro.isdc.wro4j</groupId>
+            <artifactId>wro4j-core</artifactId>
+            <version>${wro4j.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>ro.isdc.wro4j</groupId>
+            <artifactId>wro4j-extensions</artifactId>
+            <version>${wro4j.version}</version>
+            <exclusions>
+              <exclusion>
+                <groupId>javax.servlet</groupId>
+                <artifactId>servlet-api</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>commons-io</groupId>
+                <artifactId>commons-io</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-web</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>com.google.code.gson</groupId>
+                <artifactId>gson</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>com.google.javascript</groupId>
+                <artifactId>closure-compiler</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>com.github.lltyk</groupId>
+                <artifactId>dojo-shrinksafe</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.jruby</groupId>
+                <artifactId>jruby-core</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.jruby</groupId>
+                <artifactId>jruby-stdlib</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>me.n4u.sass</groupId>
+                <artifactId>sass-gems</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>nz.co.edmi</groupId>
+                <artifactId>bourbon-gem-jar</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.codehaus.gmaven.runtime</groupId>
+                <artifactId>gmaven-runtime-1.7</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>jshint</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>emberjs</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>handlebars</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>coffee-script</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>jslint</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>json2</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.webjars</groupId>
+                <artifactId>jquery</artifactId>
+              </exclusion>
+            </exclusions>
+          </dependency>
+        </dependencies>
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
diff --git a/src/main/webapp/WEB-INF/wro.properties b/src/main/webapp/WEB-INF/wro.properties
new file mode 100644 (file)
index 0000000..597e453
--- /dev/null
@@ -0,0 +1,4 @@
+managerFactoryClassName=ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory
+preProcessors=cssUrlRewriting,lessCssImport
+postProcessors=less4j
+disableCache=true
diff --git a/src/main/webapp/WEB-INF/wro.xml b/src/main/webapp/WEB-INF/wro.xml
new file mode 100644 (file)
index 0000000..73ce6ea
--- /dev/null
@@ -0,0 +1,16 @@
+<groups xmlns="http://www.isdc.ro/wro">
+
+  <group name="base">
+    <css>/less/base/browserreset.less</css>
+    <css>/less/base/fonts.less</css>
+    <css>/less/base/util.less</css>
+    <css>/less/base/typo.less</css>
+    <css>/less/base/layout.less</css>
+    <css>/less/base/head.less</css>
+    <css>/less/base/navigation.less</css>
+    <css>/less/base/content.less</css>
+    <css>/less/base/marginal.less</css>
+    <css>/less/base/footer.less</css>
+  </group>
+
+</groups>
diff --git a/src/main/webapp/less/base.less b/src/main/webapp/less/base.less
deleted file mode 100644 (file)
index 1bbbe45..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-@charset "UTF-8";
-
-/**
- * Diese Datei wird nur verwendet, wenn die Webanwendung via
- * "mvn jetty:run" gestartet wird (z.B. über das Shell-Skript run.sh).
- * Ansonsten werden die CSS-Dateien beim ausführen des Befehls "mvn package"
- * minifiziert und in der Datei /css/base.css zusammengefasst.
- *
- * Damit alles (auf dem Produktivserver _und_ in der Test-Umgebung) wie
- * erwartet funktioniert, müssen neue CSS-Schnipsel hier und in der POM
- * im Modul web eingetragen werden!
- */
-
-@import 'base/browserreset';
-@import 'base/fonts';
-@import 'base/typo';
-@import 'base/util';
-@import 'base/head';
-@import 'base/navigation';
-@import 'base/layout';
-@import 'base/content';
-@import 'base/marginal';
-@import 'base/footer';
diff --git a/src/test/resources/jetty-web.xml b/src/test/resources/jetty-web.xml
new file mode 100644 (file)
index 0000000..089e3c9
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+  version="2.5">
+
+  <filter>
+    <filter-name>wro</filter-name>
+    <filter-class>ro.isdc.wro.http.WroFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>wro</filter-name>
+    <url-pattern>*.css</url-pattern>
+  </filter-mapping>
+
+</web-app>