From bca14c0d095f63275cdbe46aca946673465c56d6 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 6 Jun 2013 23:48:25 +0300 Subject: Correctly report theme version in the debug window (#11442) * Adds a special v-vaadin-version selector for detecting the theme version * The version in the base theme is replaced during build (for releases) and by the current version also when compiling in the IDE Change-Id: Id6b94ab2edead61602fed021b7152f6e46be809f --- .../src/com/vaadin/buildhelpers/CompileTheme.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'theme-compiler/src') diff --git a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java index 3cd08c4abc..dece1691f0 100644 --- a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java +++ b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java @@ -29,6 +29,7 @@ import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; import com.vaadin.sass.internal.ScssStylesheet; +import com.vaadin.shared.Version; /** * Helper to combine css divided into separate per component dirs into one to @@ -44,8 +45,6 @@ public class CompileTheme { public static void main(String[] args) throws IOException, ParseException { Options options = new Options(); options.addOption("t", "theme", true, "the theme to compile"); - options.addOption("v", "theme-version", true, - "the version to add to the compiled theme"); options.addOption("f", "theme-folder", true, "the folder containing the theme"); CommandLineParser parser = new PosixParser(); @@ -58,11 +57,11 @@ public class CompileTheme { } String themeName = params.getOptionValue("theme"); String themeFolder = params.getOptionValue("theme-folder"); - String themeVersion = params.getOptionValue("theme-version"); // Regular theme try { - processSassTheme(themeFolder, themeName, "styles", themeVersion); + processSassTheme(themeFolder, themeName, "styles", + Version.getFullVersion()); System.out.println("Compiling theme " + themeName + " styles successful"); } catch (Exception e) { @@ -73,7 +72,7 @@ public class CompileTheme { // Legacy theme w/o .themename{} wrapping try { processSassTheme(themeFolder, themeName, "legacy-styles", - themeVersion); + Version.getFullVersion()); System.out.println("Compiling theme " + themeName + " legacy-styles successful"); } catch (Exception e) { @@ -88,11 +87,6 @@ public class CompileTheme { StringBuffer cssHeader = new StringBuffer(); - version = version.replaceAll("\\.", "_"); - cssHeader.append(".v-theme-version:after {content:\"" + version - + "\";}\n"); - cssHeader.append(".v-theme-version-" + version + " {display: none;}\n"); - String stylesCssDir = themeFolder + File.separator + themeName + File.separator; @@ -107,10 +101,9 @@ public class CompileTheme { + " not found"); } scss.compile(); - BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName)); out.write(cssHeader.toString()); - out.write(scss.toString()); + out.write(scss.toString().replace("@version@", version)); out.close(); System.out.println("Compiled CSS to " + stylesCssName + " (" -- cgit v1.2.3