From 7f49212985a9c8dd9b23939564dc07d30ad9b4dd Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 27 Jun 2017 10:47:29 +0200 Subject: [PATCH] less.js ausgebaut --- dist/thymeleaf/about.html | 7 +++--- dist/thymeleaf/agb.html | 7 +++--- dist/thymeleaf/blog.html | 9 +++---- dist/thymeleaf/blog/article.html | 25 +++++++++---------- dist/thymeleaf/blog/comments.html | 7 +++--- dist/thymeleaf/contact.html | 7 +++--- dist/thymeleaf/datenschutz.html | 7 +++--- dist/thymeleaf/expertise.html | 7 +++--- dist/thymeleaf/google-analytics.html | 7 +++--- dist/thymeleaf/haftung-inhalte.html | 7 +++--- dist/thymeleaf/haftung-links.html | 7 +++--- dist/thymeleaf/impressum.html | 7 +++--- dist/thymeleaf/index.html | 7 +++--- dist/thymeleaf/potemkin/accelerator.html | 7 +++--- .../potemkin/fix-swf/getting-started.html | 7 +++--- dist/thymeleaf/potemkin/fix-swf/overview.html | 7 +++--- dist/thymeleaf/potemkin/html-experimente.html | 7 +++--- .../html-experimente/basis-layout.html | 3 +-- .../potemkin/html-experimente/breadcrumb.html | 7 +++--- .../html-experimente/druck-layout.html | 5 ++-- .../potemkin/html-experimente/error.html | 6 ++--- ...st-leer-einspaltig-mit-marginalinhalt.html | 7 +++--- .../fast-leer-einspaltig.html | 7 +++--- ...kein-men\303\274-aber-marginalinhalt.html" | 7 +++--- .../fast-leer-kein-men\303\274.html" | 7 +++--- ...r-mit-men\303\274-und-marginalinhalt.html" | 7 +++--- .../fast-leer-mit-men\303\274.html" | 7 +++--- .../potemkin/html-experimente/formulare.html | 7 +++--- .../potemkin/html-experimente/phone.html | 5 ++-- .../html-experimente/seitenaufteilung.html | 5 ++-- .../potemkin/html-experimente/seitenkopf.html | 5 ++-- .../potemkin/html-experimente/symbole.html | 7 +++--- .../potemkin/html-experimente/tablet.html | 5 ++-- .../potemkin/html-experimente/testlab.html | 7 +++--- .../potemkin/html-experimente/tiny.html | 5 ++-- dist/thymeleaf/potemkin/typo.html | 7 +++--- dist/thymeleaf/projects.html | 7 +++--- dist/thymeleaf/references.html | 7 +++--- dist/thymeleaf/templates/404.html | 7 +++--- dist/thymeleaf/templates/error.html | 7 +++--- dist/thymeleaf/templates/fragments.html | 7 +++--- dist/thymeleaf/templates/layout.html | 9 +++---- dist/thymeleaf/urheberrechte.html | 7 +++--- 43 files changed, 132 insertions(+), 174 deletions(-) diff --git a/dist/thymeleaf/about.html b/dist/thymeleaf/about.html index 3beb588d..48c7707c 100644 --- a/dist/thymeleaf/about.html +++ b/dist/thymeleaf/about.html @@ -9,10 +9,9 @@ About - - - - + + + diff --git a/dist/thymeleaf/agb.html b/dist/thymeleaf/agb.html index 9eb4b576..5c48e755 100644 --- a/dist/thymeleaf/agb.html +++ b/dist/thymeleaf/agb.html @@ -9,10 +9,9 @@ Allgemeine Geschäftsbedingungen (AGB) - - - - + + + diff --git a/dist/thymeleaf/blog.html b/dist/thymeleaf/blog.html index 53d8de22..9a02809d 100644 --- a/dist/thymeleaf/blog.html +++ b/dist/thymeleaf/blog.html @@ -9,10 +9,9 @@ Blog - - - - + + + @@ -28,7 +27,7 @@ diff --git a/dist/thymeleaf/blog/article.html b/dist/thymeleaf/blog/article.html index 0c175d8e..49dfb5ad 100644 --- a/dist/thymeleaf/blog/article.html +++ b/dist/thymeleaf/blog/article.html @@ -9,10 +9,9 @@ juplo - blog - Combining jetty-maven-plugin and wro4j-maven-plugin for Dynamic Reloading of LESS-Resources - - - - + + + @@ -25,18 +24,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 +49,13 @@ <groups xmlns="http://www.isdc.ro/wro"> <group name="base"> - <css>/less/base/*.less</css> + <css>/css/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 /css/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
@@ -205,7 +204,7 @@
   
           

The filter processes any URI’s that end with .css. This way, the wro4j servlet-filter makes base.css available under any path, because for exampl /base.css, /css/base.css and /foo/bar/base.css all end with .css.

-

This is all, that is needed to develop with dynamically reloadable compiled LESS-resources. Just fire up your browser and browse to /what/you/like/base.css. (But do not forget to put some LESS-files in src/main/webapp/less/base/ first!)

+

This is all, that is needed to develop with dynamically reloadable compiled LESS-resources. Just fire up your browser and browse to /what/you/like/base.css. (But do not forget to put some LESS-files in src/main/webapp/css/base/ first!)

Step 3: Install wro4j-maven-plugin

All that is left over to configure now, is the build-process. If you would build and deploy your webapp now, the CSS-file base.css would not be generated and the link to your stylesheet, that already works in our jetty-maven-plugin environment would point to a 404. Hence, we need to set up the wro4j-maven-plugin. I am using this configuration:

@@ -253,7 +252,7 @@
           

We only scrached the surface, of what can be done with wro4j. Based on this configuration, you can easily enable additional features to fine-tune your final build for maximum speed. You really should take a look at the list of available Processors!

diff --git a/dist/thymeleaf/blog/comments.html b/dist/thymeleaf/blog/comments.html index b4ef2302..02a97fef 100644 --- a/dist/thymeleaf/blog/comments.html +++ b/dist/thymeleaf/blog/comments.html @@ -9,10 +9,9 @@ juplo - blog - hibernate4-maven-plugin - - - - + + + diff --git a/dist/thymeleaf/contact.html b/dist/thymeleaf/contact.html index a2caf6c6..597dab26 100644 --- a/dist/thymeleaf/contact.html +++ b/dist/thymeleaf/contact.html @@ -9,10 +9,9 @@ Contact - - - - + + + diff --git a/dist/thymeleaf/datenschutz.html b/dist/thymeleaf/datenschutz.html index 77b6be15..5df0f47b 100644 --- a/dist/thymeleaf/datenschutz.html +++ b/dist/thymeleaf/datenschutz.html @@ -9,10 +9,9 @@ Datenschutz - - - - + + + diff --git a/dist/thymeleaf/expertise.html b/dist/thymeleaf/expertise.html index 5e641143..75a5d7eb 100644 --- a/dist/thymeleaf/expertise.html +++ b/dist/thymeleaf/expertise.html @@ -9,10 +9,9 @@ Expertise - - - - + + + diff --git a/dist/thymeleaf/google-analytics.html b/dist/thymeleaf/google-analytics.html index 6207704b..9903ed88 100644 --- a/dist/thymeleaf/google-analytics.html +++ b/dist/thymeleaf/google-analytics.html @@ -9,10 +9,9 @@ Google Analytics - - - - + + + diff --git a/dist/thymeleaf/haftung-inhalte.html b/dist/thymeleaf/haftung-inhalte.html index b3183bc7..5d09df75 100644 --- a/dist/thymeleaf/haftung-inhalte.html +++ b/dist/thymeleaf/haftung-inhalte.html @@ -9,10 +9,9 @@ Haftung für Inhalte - - - - + + + diff --git a/dist/thymeleaf/haftung-links.html b/dist/thymeleaf/haftung-links.html index 8894c74e..4778f919 100644 --- a/dist/thymeleaf/haftung-links.html +++ b/dist/thymeleaf/haftung-links.html @@ -9,10 +9,9 @@ Haftung für Links - - - - + + + diff --git a/dist/thymeleaf/impressum.html b/dist/thymeleaf/impressum.html index 20a15627..b7a950af 100644 --- a/dist/thymeleaf/impressum.html +++ b/dist/thymeleaf/impressum.html @@ -9,10 +9,9 @@ Impressum - - - - + + + diff --git a/dist/thymeleaf/index.html b/dist/thymeleaf/index.html index 98720af5..fa40ae83 100644 --- a/dist/thymeleaf/index.html +++ b/dist/thymeleaf/index.html @@ -9,10 +9,9 @@ Home - - - - + + + diff --git a/dist/thymeleaf/potemkin/accelerator.html b/dist/thymeleaf/potemkin/accelerator.html index 39c57148..fa3cbf09 100644 --- a/dist/thymeleaf/potemkin/accelerator.html +++ b/dist/thymeleaf/potemkin/accelerator.html @@ -9,10 +9,9 @@ Fix SWF - Overview - - - - + + + juplo - BASISTEMPLATE - - - + + +