mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Use binary stylesheets when possible
This commit is contained in:
parent
32e3b2341b
commit
2494d9d45f
3 changed files with 27 additions and 6 deletions
|
@ -170,7 +170,25 @@ task runAttachedDebugger(type: JavaExec) {
|
|||
systemProperties run.systemProperties
|
||||
}
|
||||
|
||||
task writeLicenses(type: DefaultTask) {
|
||||
processResources {
|
||||
doLast {
|
||||
def cssFiles = fileTree(dir: "$sourceSets.main.output.resourcesDir/io/xpipe/app/resources/style")
|
||||
cssFiles.include "**/*.css"
|
||||
cssFiles.each { css ->
|
||||
logger.info("converting CSS to BSS ${css}");
|
||||
|
||||
javaexec {
|
||||
workingDir = project.projectDir
|
||||
jvmArgs += "--module-path=$sourceSets.main.runtimeClasspath.asPath,"
|
||||
jvmArgs += "--add-modules=javafx.graphics"
|
||||
main = "com.sun.javafx.css.parser.Css2Bin"
|
||||
args css
|
||||
}
|
||||
|
||||
delete css
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
def resourcesDir = new File(sourceSets.main.output.resourcesDir, "io/xpipe/app/resources/third-party")
|
||||
resourcesDir.mkdirs()
|
||||
|
@ -180,7 +198,6 @@ task writeLicenses(type: DefaultTask) {
|
|||
}
|
||||
}
|
||||
}
|
||||
processResources.finalizedBy(writeLicenses)
|
||||
|
||||
distTar {
|
||||
enabled = false;
|
||||
|
|
|
@ -54,9 +54,13 @@ public class AppStyle {
|
|||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
try {
|
||||
var bytes = Files.readAllBytes(file);
|
||||
var s = "data:text/css;base64,"
|
||||
+ Base64.getEncoder().encodeToString(bytes);
|
||||
STYLESHEET_CONTENTS.put(file, s);
|
||||
if (file.getFileName().toString().endsWith(".bss")) {
|
||||
var s = "data:application/octet-stream;base64," + Base64.getEncoder().encodeToString(bytes);
|
||||
STYLESHEET_CONTENTS.put(file, s);
|
||||
} else if (file.getFileName().toString().endsWith(".css")) {
|
||||
var s = "data:text/css;base64," + Base64.getEncoder().encodeToString(bytes);
|
||||
STYLESHEET_CONTENTS.put(file, s);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ErrorEvent.fromThrowable(ex).omitted(true).build().handle();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ deleteAlertHeader=Do you want to delete the ($COUNT$) selected elements?
|
|||
selectedElements=Selected elements:
|
||||
mustNotBeEmpty=$VALUE$ must not be empty
|
||||
valueMustNotBeEmpty=Value must not be empty
|
||||
transferDescription=Drop to transfer
|
||||
transferDescription=Drop files to transfer
|
||||
dragFiles=Drag files within browser
|
||||
dragLocalFiles=Drag local files from here
|
||||
null=$VALUE$ must be not null
|
||||
|
|
Loading…
Reference in a new issue