Skip to content
Snippets Groups Projects
Commit be3ca569 authored by Ruben Backx's avatar Ruben Backx :coffee:
Browse files

Change sass to use local install instead of outdated gradle plugin

parent c63b9d89
Branches
No related tags found
1 merge request!229Version 2.2.1
...@@ -2,6 +2,7 @@ import com.diffplug.gradle.spotless.SpotlessExtension ...@@ -2,6 +2,7 @@ import com.diffplug.gradle.spotless.SpotlessExtension
import org.springframework.boot.gradle.tasks.bundling.BootJar import org.springframework.boot.gradle.tasks.bundling.BootJar
import nl.javadude.gradle.plugins.license.DownloadLicensesExtension import nl.javadude.gradle.plugins.license.DownloadLicensesExtension
import nl.javadude.gradle.plugins.license.LicenseExtension import nl.javadude.gradle.plugins.license.LicenseExtension
import java.nio.file.Files
group = "nl.tudelft.submit" group = "nl.tudelft.submit"
version = "2.2.0" version = "2.2.0"
...@@ -71,8 +72,6 @@ plugins { ...@@ -71,8 +72,6 @@ plugins {
// Open API generator for generating the Client code for Labracore. // Open API generator for generating the Client code for Labracore.
// is this needed? // is this needed?
// id("org.openapi.generator").version("4.2.3") // id("org.openapi.generator").version("4.2.3")
id("com.unclezs.gradle.sass").version("1.0.10")
} }
sourceSets { sourceSets {
...@@ -218,9 +217,37 @@ tasks.withType<Test>().configureEach { ...@@ -218,9 +217,37 @@ tasks.withType<Test>().configureEach {
} }
// Configure the sass compiling task to use the sass and css directories. // Configure the sass compiling task to use the sass and css directories.
sass { tasks.register("ensureDirectory") {
cssPath = "static/css" // Store target directory into a variable to avoid project reference in the configuration cache
sassPath = "scss" val directories = listOf(file("src/main/resources/static/css"), file("src/main/resources/scss"))
doLast {
directories.forEach { directory ->
Files.createDirectories(directory.toPath())
}
}
}
task<Exec>("sassCompile") {
dependsOn.add(tasks.getByName("ensureDirectory"))
if (System.getProperty("os.name").contains("windows",true)) {
commandLine("cmd", "/c", "sass", "src/main/resources/scss:src/main/resources/static/css")
} else {
commandLine("echo", "Checking for sass or sassc...")
doLast {
val res = exec {
isIgnoreExitValue = true
executable = "bash"
args = listOf("-l", "-c", "sass --version")
}
if (res.exitValue == 0) {
exec { commandLine("sass", "src/main/resources/scss:src/main/resources/static/css") }
} else {
File("src/main/resources/scss").listFiles()!!.filter { it.extension == "scss" && !it.name.startsWith("_") }.forEach {
exec { commandLine("sassc", "src/main/resources/scss/${it.name}", "src/main/resources/static/css/${it.nameWithoutExtension}.css") }
}
}
}
}
} }
dependencies { dependencies {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment