import com.eriwen.gradle.js.tasks.CombineJsTask buildscript { ext.kotlin_version = '1.2.51' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } maven { url "https://plugins.gradle.org/m2/" } mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.eriwen:gradle-js-plugin:1.12.1" } } plugins { id "com.eriwen.gradle.js" version "2.14.1" } apply plugin: 'kotlin2js' apply plugin: 'kotlin-dce-js' group 'nl.astraeus' version '0.0.1-SNAPSHOT' allprojects { ext { kotlin_version = '1.2.51' } } repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } mavenCentral() } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" compile "nl.astraeus:komp:0.1.1-SNAPSHOT" } compileKotlin2Js { kotlinOptions.metaInfo = true kotlinOptions.sourceMap = true kotlinOptions.sourceMapEmbedSources = "always" kotlinOptions.suppressWarnings = true kotlinOptions.verbose = true } runDceKotlinJs.doLast { copy { from("build/kotlin-js-min/main") into("web/js/generated") } } // Create new CombineJsTasks if you have multiple sets of JS files task combineKotlinJs(type: CombineJsTask) { dependsOn runDceKotlinJs source = [ "${projectDir}/web/js/generated/kotlin.js", "${projectDir}/web/js/generated/min/kotlinx-html-js.js", "${projectDir}/web/js/generated/min/komp.js", "${projectDir}/web/js/generated/min/komp-todo.js" ] dest = file("${projectDir}/web/js/generated/todo.all.js") } minifyJs { source = combineKotlinJs dest = file("${projectDir}/web/js/generated/todo.all.min.js") closure { warningLevel = 'QUIET' compilerOptions.languageIn = "ECMASCRIPT5" } }