Is there a way to inject the `build.gradle.kts` `p...
# javascript
y
Is there a way to inject the
build.gradle.kts
project.version
variable in the Javascript code? I need this value to drive some of my code and so far I hardcoded it in the kotlin code, but if I change it in the build file and forget to change it in the kotlin code it will create some issues...
r
I've only used it on JVM, but https://github.com/gmazzo/gradle-buildconfig-plugin seems like it would work
a
I wrote a plugin to generate a kotlin file with values I wanted.
I was going to link you my sample, but that actual maintained and published plugin seems a lot better than copy pasting my code :D
t
You also can generate
js
file and include like
external
y
Thanks for the answers. @turansky how would you "generate js file and include like external"?
t
You can add any
js
file in DCE dir (
build/js/packages/%your-project%/kotlin-dce
) And use it in your project (
my.js
for example)
Copy code
@file:JsModule("my")

external class MyClass