Compile css to bss to speed up launching

This commit is contained in:
huanghongxun 2018-11-11 21:12:03 +08:00
parent a285d2c27d
commit 74a87e65c8
3 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.class
*.bss
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

View File

@ -110,6 +110,15 @@ def createExecutable(String suffix, String header) {
createChecksum(output)
}
processResources {
doLast {
exec {
workingDir new File(this.projectDir, 'src/main/resources/assets/css')
commandLine 'javapackager', '-createbss', '-outdir', '.', '-srcdir', '.'
}
}
}
task makePack(dependsOn: jar) {
ext.outputPath = new File(jar.archivePath.parentFile, jar.archivePath.name[0..-4] + "pack")
doLast {

View File

@ -84,12 +84,12 @@ public class Theme {
css = temp.toURI().toString();
} catch (IOException e) {
Logging.LOG.log(Level.SEVERE, "Unable to create theme stylesheet. Fallback to blue theme.", e);
css = Theme.class.getResource("/assets/css/blue.css").toExternalForm();
css = "/assets/css/blue.css";
}
return new String[]{
css,
Theme.class.getResource("/assets/css/root.css").toExternalForm()
"/assets/css/root.css"
};
}