summaryrefslogtreecommitdiffstats
path: root/build/buildhelpers
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-04-24 13:36:45 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-04-24 13:36:45 +0000
commit14410f2a048409af75014597717ba5fc32a83674 (patch)
tree47f9c8a49519be456ef4f7d8c8a24fa2693afe70 /build/buildhelpers
parentd59f916e26d2a9eb89c8d5c326b48f38216115dc (diff)
downloadvaadin-framework-14410f2a048409af75014597717ba5fc32a83674.tar.gz
vaadin-framework-14410f2a048409af75014597717ba5fc32a83674.zip
refactored default css rules to be in themes/default, added helperapplication to combine multiple css files, changed app init process again
svn changeset:4226/svn branch:trunk
Diffstat (limited to 'build/buildhelpers')
-rw-r--r--build/buildhelpers/com/itmill/toolkit/buildhelpers/CompileDefaultTheme.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/build/buildhelpers/com/itmill/toolkit/buildhelpers/CompileDefaultTheme.java b/build/buildhelpers/com/itmill/toolkit/buildhelpers/CompileDefaultTheme.java
new file mode 100644
index 0000000000..d5da4cf6f4
--- /dev/null
+++ b/build/buildhelpers/com/itmill/toolkit/buildhelpers/CompileDefaultTheme.java
@@ -0,0 +1,69 @@
+package com.itmill.toolkit.buildhelpers;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * Helper to combine css diveded into separate per component dirs into one to
+ * optimize http requests.
+ *
+ */
+public class CompileDefaultTheme {
+
+ private static final String SRCDIR = "./WebContent/ITMILL/themes/default";
+
+ /**
+ * @param args
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException {
+ File f = new File(SRCDIR);
+
+ StringBuffer combinedCss = new StringBuffer();
+ combinedCss
+ .append("/* Automatically compiled css file from subdirectories. */\n");
+
+ File[] subdir = f.listFiles();
+
+ for (int i = 0; i < subdir.length; i++) {
+ File dir = subdir[i];
+ String name = dir.getName();
+
+ File cssFile = new File(dir.getPath() + "/" + name + ".css");
+ if (cssFile.isFile()) {
+ FileInputStream fstream = new FileInputStream(cssFile);
+ // Get the object of DataInputStream
+ DataInputStream in = new DataInputStream(fstream);
+ BufferedReader br = new BufferedReader(
+ new InputStreamReader(in));
+ String strLine;
+ while ((strLine = br.readLine()) != null) {
+ if (strLine.indexOf("url(../") > 0) {
+ strLine = strLine.replaceAll("url\\(../", ("url\\("));
+
+ } else {
+ strLine = strLine.replaceAll("url\\(",
+ ("url\\(" + name + "/"));
+
+ }
+ combinedCss.append(strLine);
+ combinedCss.append("\n");
+ }
+ // Close the input stream
+ in.close();
+ }
+ }
+
+ BufferedWriter out = new BufferedWriter(new FileWriter(SRCDIR
+ + "/styles.css"));
+ out.write(combinedCss.toString());
+ out.close();
+
+ }
+}