diff options
author | John Ahlroos <john@vaadin.com> | 2013-04-18 12:37:06 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-04-18 12:51:39 +0000 |
commit | 457afbaeda4373541a634b12d195dd847948f1e2 (patch) | |
tree | e696896cb0beaf134bf9cf007837d1744adae331 /client-compiler | |
parent | 19c3783d3e3cb9ba56e3587581115f354ab04fa0 (diff) | |
download | vaadin-framework-457afbaeda4373541a634b12d195dd847948f1e2.tar.gz vaadin-framework-457afbaeda4373541a634b12d195dd847948f1e2.zip |
Ensure addon css styles are before scss styles in addons.scss #11390
Change-Id: I3737a94f076917cd896bd90e2936a5b752ccd801
Diffstat (limited to 'client-compiler')
-rw-r--r-- | client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index 98ce639d16..5cec9bd9d5 100644 --- a/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -21,6 +21,10 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import java.util.Map; import com.vaadin.server.widgetsetutils.ClassPathExplorer; @@ -89,8 +93,29 @@ public class SASSAddonImportFileCreator { printStream.println(); Map<String, URL> addonThemes = info.getAddonStyles(); - for (String path : addonThemes.keySet()) { + + // Sort addon styles so that CSS imports are first and SCSS import + // last + List<String> paths = new ArrayList<String>(addonThemes.keySet()); + Collections.sort(paths, new Comparator<String>() { + + @Override + public int compare(String path1, String path2) { + if (path1.toLowerCase().endsWith(".css") + && path2.toLowerCase().endsWith(".scss")) { + return -1; + } + if (path1.toLowerCase().endsWith(".scss") + && path2.toLowerCase().endsWith(".css")) { + return 1; + } + return 0; + } + }); + + for (String path : paths) { addImport(printStream, path, addonThemes.get(path)); + printStream.println(); } } catch (FileNotFoundException e) { |