X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=dist%2Fthymeleaf%2Fblog%2Farticle.html;h=2873911fc029b716121c71b6df11e42f5ed64d0e;hb=7991acb8dcde417b83e4fbcca18fe4c52d610c4c;hp=ff309e31da7655985830cab307d1a47f70d7736f;hpb=2555f2602b16f8f21499d3727817bae2adc6ab69;p=website diff --git a/dist/thymeleaf/blog/article.html b/dist/thymeleaf/blog/article.html index ff309e31..2873911f 100644 --- a/dist/thymeleaf/blog/article.html +++ b/dist/thymeleaf/blog/article.html @@ -9,9 +9,9 @@ juplo - blog - Combining jetty-maven-plugin and wro4j-maven-plugin for Dynamic Reloading of LESS-Resources - - - + + + @@ -25,18 +25,18 @@
-

Ever searched for a simple configuration, that lets you use your jetty-maven-plugin as you are used to, while working with LESS to simplify your stylesheets?

-

You cannot do both, use the Client-side mode of LESS to ease development and use the lesscss-maven-plugin to automatically compile the LESS-sources into CSS for production. That does not work, because your stylesheets must be linked in different ways if you are switching between the client-side mode – which is best for development – and the pre-compiled mode – which is best for production. For the client-side mode you need something like:

+

Ever searched for a simple configuration, that lets you use your jetty-maven-plugin as you are used to, while working with LESS to simplify your stylesheets?

+

You cannot do both, use the Client-side mode of LESS to ease development and use the lesscss-maven-plugin to automatically compile the LESS-sources into CSS for production. That does not work, because your stylesheets must be linked in different ways if you are switching between the client-side mode – which is best for development – and the pre-compiled mode – which is best for production. For the client-side mode you need something like:

   
-  <link rel="stylesheet/less" type="text/css" href="styles.less" />
+  <link rel="stylesheet" type="text/css" href="styles.css" />
   <script src="../less.js" type="text/javascript"></script>
   
           

While, for the pre-compiled mode, you want to link to your stylesheets as usual, with:

   
-  <link rel="stylesheet/less" type="text/css" href="styles.css" />
+  <link rel="stylesheet" type="text/css" href="styles.css" />
   
           

While looking for a solution to this dilemma, I stumbled accross wro4j. Originally intended, to speed up page-delivery by combining and minimizing multiple resources into one through the use of a servlet-filter, this tool also comes with a maven-plugin, that let you do the same offline, while compiling your webapp.

@@ -50,13 +50,13 @@ <groups xmlns="http://www.isdc.ro/wro"> <group name="base"> - <css>/less/base/*.less</css> + <css>/less/base/*.css</css> </group> -

wro4j looks for /less/base/*.less inside the root of the web-context, which is equal to src/main/webapp in a normal maven-project. There are other ways to specifie the resources, which enable you to store them elswhere. But this approach works best for our goal, because the path is understandable for both: the wro4j servlet-filter, we are configuring now for our development-environment, and the wro4j-maven-plugin, that we will configure later for build-time compilation.

+

wro4j looks for /less/base/*.css inside the root of the web-context, which is equal to src/main/webapp in a normal maven-project. There are other ways to specifie the resources, which enable you to store them elswhere. But this approach works best for our goal, because the path is understandable for both: the wro4j servlet-filter, we are configuring now for our development-environment, and the wro4j-maven-plugin, that we will configure later for build-time compilation.

wro.properties

-

wro.properties in short tells wro4j, how or if it should convert the combined sources and how it should behave. I am using the following configuration to tell wro4j, that it should convert *.less-sources into CSS and do that on every request:

+

wro.properties in short tells wro4j, how or if it should convert the combined sources and how it should behave. I am using the following configuration to tell wro4j, that it should convert *.css-sources into CSS and do that on every request:

   
   preProcessors=less4j