plugins { id 'kotlin2js' version '1.3.21' } group 'io.jamesbarnett' version '1.0-SNAPSHOT' repositories { mavenCentral() maven { url 'https://jitpack.io' } } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js" compile "com.github.markaren:three.kt:v0.88-ALPHA-7" testImplementation "org.jetbrains.kotlin:kotlin-test-js" } task assembleWeb(type: Sync) { configurations.compile.each { File file -> from(zipTree(file.absolutePath), { includeEmptyDirs = false include { fileTreeElement -> def path = fileTreeElement.path path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/")) } }) } from compileKotlin2Js.destinationDir into "${projectDir}/web/kotlin" dependsOn classes } assemble.dependsOn assembleWeb task copyWebResources(type: Sync) { from "${projectDir}/src/main/resources" into "${projectDir}/web" } assembleWeb.dependsOn copyWebResources clean.doFirst() { delete("${projectDir}/web") }