buildscript { ext.kotlin_version = '1.1.4-3' repositories { jcenter() maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.20" } } group = 'pl.treksoft' version = '0.0.1-SNAPSHOT' apply plugin: 'kotlin2js' apply plugin: 'org.jetbrains.kotlin.frontend' repositories { jcenter() maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' } maven { url = 'https://dl.bintray.com/rjaros/kotlin' } } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported compile "com.github.snabbdom:snabbdom-kotlin:0.1.0" compile "pl.treksoft:navigo-kotlin:0.0.1" } kotlinFrontend { npm { dependency "jquery" dependency "bootstrap" dependency "css-loader" dependency "style-loader" dependency "less" dependency "less-loader" dependency "imports-loader" dependency "bootstrap-webpack" dependency "font-awesome" dependency("font-awesome-webpack", "0.0.5-beta.2") dependency "file-loader" dependency "url-loader" dependency("snabbdom", "0.6.9") dependency "snabbdom-virtualize" dependency "navigo" devDependency("karma") } webpackBundle { bundleName = "main" contentPath = file('src/main/web') } define "PRODUCTION", false } compileKotlin2Js { kotlinOptions.metaInfo = true kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" kotlinOptions.sourceMap = true kotlinOptions.moduleKind = 'commonjs' } compileTestKotlin2Js { kotlinOptions.metaInfo = true kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" kotlinOptions.sourceMap = true kotlinOptions.moduleKind = 'commonjs' } task copyResources(type: Copy) { from "src/main/assets" into file(buildDir.path + "/js") } afterEvaluate { tasks.getByName("webpack-bundle") { dependsOn(copyResources) } tasks.getByName("webpack-run") { dependsOn(copyResources) } }