Kotlin to JavaScript getting started


#1

Hello all!

I’m newbie in Idea and Kotlin. I want to start Kotlin to JavaScript development, but i dont understand how configure my project for this purpose?

I have an Idea 13.1.1 and Kotlin plugin. I created Kotlin(JavaScript) project. In the src folder i created folder “web” and index.html file in this web folder. In the Run configuration i choose this folder for “Generated JavaScript file directory” and also set my index.html file.

But i can’t run my “Hello World” project, run button is disabled.

Thanks alot for any advice!


Questions about the Javascript API
#2

I wrote a somewhat step by step tutorial here:

http://blog.jetbrains.com/kotlin/2013/10/writing-kotlin-in-the-browser/

Let me know if that helps.


#3

I configured output MyFile.Kt to folder js/app/ from your tutorial, but because i'm newbie in Idea, i don't understand how create artefact to copy kotlin.js to js/lib/ folder?

Can i place manually kotlin.js to js/lib/ folder at first time, or content of the kotlin.js file is dynamically and i must to configure artefacts?

upd: after copying the file kotlin.js to js/lib folder, my “Hello World Project” works fine!


#4

You can copy the file manually yes or just create an artifact for it. I think in the blog post I mention a link in order to do that.   


#5

Hi, Kirill

You can find simple k2js project in attachment.

Feel free to ask any questions. :wink:



k2js-example.zip (31.1 KB)