summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-04-23 14:09:48 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-24 08:32:11 +0000
commit2c3b714c37cf261b56cc85277bd70349780446d7 (patch)
tree7e29f72f331eebbb2d5d3b454092ecf14f890e90
parentcb7b02d4e50e91b9377410e79c3578587a900d94 (diff)
downloadvaadin-framework-2c3b714c37cf261b56cc85277bd70349780446d7.tar.gz
vaadin-framework-2c3b714c37cf261b56cc85277bd70349780446d7.zip
addons.scss should contain "addons"-mixin and include all found mixins into that.
Also now that addon stylesheet metadata now contains the full path of the stylesheet, the @import should handle it by prefixing the paths with "../" . Change-Id: I9631e8151e053337e6d0fa2023c38faeec7a0a5b
-rw-r--r--server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java42
1 files changed, 32 insertions, 10 deletions
diff --git a/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
index 5cec9bd9d5..f199c347eb 100644
--- a/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
+++ b/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
@@ -45,8 +45,8 @@ public class SASSAddonImportFileCreator {
private static final String ADDON_IMPORTS_FILE = "addons.scss";
- private static final String ADDON_IMPORTS_FILE_TEXT = "This file is managed by the Eclipse plug-in and "
- + "will be overwritten from time to time. Do not manually edit this file.";
+ private static final String ADDON_IMPORTS_FILE_TEXT = "This file is automatically managed and "
+ + "will be overwritten from time to time.";
/**
*
@@ -90,6 +90,8 @@ public class SASSAddonImportFileCreator {
printStream.println("/* " + ADDON_IMPORTS_FILE_TEXT + " */");
+ printStream.println("/* Do not manually edit this file. */");
+
printStream.println();
Map<String, URL> addonThemes = info.getAddonStyles();
@@ -113,37 +115,46 @@ public class SASSAddonImportFileCreator {
}
});
+ List<String> mixins = new ArrayList<String>();
for (String path : paths) {
- addImport(printStream, path, addonThemes.get(path));
+ mixins.addAll(addImport(printStream, path,
+ addonThemes.get(path)));
printStream.println();
}
+ createAddonsMixin(printStream, mixins);
+
} catch (FileNotFoundException e) {
// Should not happen since file is checked before this
e.printStackTrace();
}
}
- private static void addImport(PrintStream stream, String file, URL location) {
+ private static List<String> addImport(PrintStream stream, String file,
+ URL location) {
// Add import comment
printImportComment(stream, location);
+ List<String> foundMixins = new ArrayList<String>();
+
if (file.endsWith(".css")) {
- stream.print("@import url(\"../" + file + "\");\n");
+ stream.print("@import url(\"../../../" + file + "\");\n");
} else {
// Assume SASS
- stream.print("@import \"../" + file + "\";\n");
+ stream.print("@import \"../../../" + file + "\";\n");
- // Convention is to name the mixing after the stylesheet. Strip
+ // Convention is to name the mixin after the stylesheet. Strip
// .scss from filename
String mixin = file.substring(file.lastIndexOf("/") + 1,
file.length() - ".scss".length());
- stream.print("@include " + mixin + ";");
+ foundMixins.add(mixin);
}
stream.println();
+
+ return foundMixins;
}
private static void printImportComment(PrintStream stream, URL location) {
@@ -164,8 +175,19 @@ public class SASSAddonImportFileCreator {
// location.getPath() returns
}
- stream.println("/* Added by Vaadin Plug-in for Eclipse from " + path
- + " */");
+ stream.println("/* Provided by " + path + " */");
+ }
+
+ private static void createAddonsMixin(PrintStream stream,
+ List<String> mixins) {
+
+ stream.println("/* Import and include this mixin into your project theme to include the addon themes */");
+ stream.println("@mixin addons {");
+ for (String addon : mixins) {
+ stream.println("\t@include " + addon + ";");
+ }
+ stream.println("}");
+ stream.println();
}
private static void printUsage() {