]> source.dussan.org Git - vaadin-framework.git/commitdiff
Compile themes without sprites if SmartSprites is not found
authorArtur Signell <artur@vaadin.com>
Tue, 11 Sep 2012 12:24:04 +0000 (15:24 +0300)
committerArtur Signell <artur@vaadin.com>
Tue, 11 Sep 2012 12:24:04 +0000 (15:24 +0300)
theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java

index 669e311f824245eb19557e5d93f500646ebbdc64..90e3faf10ef23f42fff66afdc8c300abe397b6b8 100644 (file)
@@ -86,7 +86,6 @@ public class CompileTheme {
                 + scss.toString().length() + " bytes)");
 
         createSprites(themeFolder, themeName);
-        System.out.println("Used SmartSprites to create sprites");
         File oldCss = new File(stylesCssName);
         File newCss = new File(stylesCssDir + "styles-sprite.css");
 
@@ -105,12 +104,20 @@ public class CompileTheme {
 
     private static void createSprites(String themeFolder, String themeName)
             throws FileNotFoundException, IOException {
-        String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
-                "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
-                "--root-dir-path", themeFolder + File.separator + themeName,
-                "--log-level", "WARN" };
-
-        org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
+        try {
+            String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
+                    "--css-file-suffix", "-sprite", "--css-file-encoding",
+                    "UTF-8", "--root-dir-path",
+                    themeFolder + File.separator + themeName, "--log-level",
+                    "WARN" };
+
+            org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
+            System.out.println("Generated sprites");
+
+        } catch (NoClassDefFoundError e) {
+            System.err
+                    .println("Could not find smartsprites. No sprites were generated. The theme should still work.");
+        }
 
     }
 }