rewrite branch
import groovy.transform.Fieldimport org.apache.tools.ant.taskdefs.condition.Os// Special handling for Windows. Fuck. This. Shit.@Field var isWindows = (Os.isFamily(Os.FAMILY_WINDOWS))tasks.register("processCSS") {doLast {def rootDir = rootProject.projectDir.absolutePathdef resDir = "$rootDir/materialfx/src/main/resources/io/github/palexdev/materialfx"List<File> themesDirs = new ArrayList<>()new File(resDir).eachFile {if (it.isDirectory() && it.name != "jfx") themesDirs += it}// Check if npm and cssbeautify-cli are installed on the hostif (!execute("npm -v")) throw new GradleException("npm command could not be found")if (!execute("cssbeautify-cli -v")) throw new GradleException("cssbeautify-cli command could not be found")logger.warn("All dependencies have been found")themesDirs.each { dir ->dir.eachFileRecurse {def name = it.namedef path = it.absolutePathdef parent = it.parentif (name.endsWith(".css")) { // Unfortunately, doesn't run very well o SCSS fileslogger.warn("Beautifying: $name")def tmp = new File("${path}.tmp")it.renameTo(tmp)def beautifyCommand = "cssbeautify-cli -a -i2 -f ${path}.tmp -w $parent/$name"execute(beautifyCommand)delete(tmp)}}}}}boolean execute(String str) {if (isWindows) str = "cmd /c " + str // Prepend call to cmdProcess proc = new ProcessBuilder().with {command str.split(" ")redirectOutput(ProcessBuilder.Redirect.DISCARD)}.start()proc.waitForOrKill(10_000)return proc.exitValue() == 0}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。