I’m trying to use only `.gradle.kts` instead of `....
# gradle
g
I’m trying to use only
.gradle.kts
instead of
.gradle
ones on my project. And I’m having a lot of doubts because of this. How can I convert this to
kts
?
Copy code
kotlinFrontend {
    downloadNodeJsVersion = 'latest'

    sourceMaps = true

    npm {
        dependency "style-loader"
        dependency("react")
        dependency("react-dom")

        devDependency("karma")
    }

    webpackBundle {
        bundleName = "main"
        contentPath = file('src/main/web')
    }
}
Using something like
task("kotlinFrontend") {
don’t work since the inner parts aren’t recognized.
l
kotlinFrontend
is a block to configure the frontend plugin, so it should be defined as
kotlinFrontend { }
or
configure<KotlinFrontendExtension> { }
. The
task()
function is used to configure Gradle Tasks only. I didn't tried, but maybe this sample could help. https://github.com/gyulavoros/kotlin-todomvc/blob/master/frontend/build.gradle.kts
g
Thanks a lot 😃
g
task("kotlinFrontend") {
don’t work since the inner parts aren’t recognized.
In general, to make it work you have to specify also type of task, but also it’s incorrect syntax, because this syntax, you have to say do you want to create or get existing task
but in this case this is not a task, but extension
kotlinFrontend should work if you use plugins dsl, how in example that Danilo shared