aboutsummaryrefslogtreecommitdiffstats
path: root/build
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
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')
-rw-r--r--build/build.xml13
-rw-r--r--build/buildhelpers/com/itmill/toolkit/buildhelpers/CompileDefaultTheme.java69
2 files changed, 80 insertions, 2 deletions
diff --git a/build/build.xml b/build/build.xml
index 258642ba69..dc835ed6ee 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -521,7 +521,7 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
WebContent
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <target name="webcontent" depends="preprocess-src">
+ <target name="webcontent" depends="preprocess-src,defaulttheme">
<!-- copy 3rd part libraries used by demo -->
<copy todir="${output-dir}/WebContent/demo/lib">
@@ -585,6 +585,15 @@
<javac source="1.4" target="1.4" classpathref="compile.classpath" srcdir="${result-path}/src" destdir="${result-path}/classes" includes="${toolkit-package}/**" debug="true">
</javac>
</target>
+
+ <target name="defaulttheme" >
+ <echo>Combining default themes css files</echo>
+ <java classname="com.itmill.toolkit.buildhelpers.CompileDefaultTheme" failonerror="yes" fork="yes">
+ <classpath>
+ <pathelement location="build/buildhelpers" />
+ </classpath>
+ </java>
+ </target>
<target name="compile-client-side" depends="webcontent">
<echo>Compiling src (client-side)</echo>
@@ -690,7 +699,7 @@
</fileset>
</copy>
</target>
-
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Documentation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
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();
+
+ }
+}