Can I include files in Julius

34 views
Skip to first unread message

kees Bleijenberg

unread,
Jun 23, 2022, 7:37:29 AM6/23/22
to Yesod Web Framework
I write the javascript for the site in TypeScript. After compiling I copy and paste the javascript in  the Julius file. 
I wonder if it's possible to use something like #include myJavascript.js to insert the generated javascript in a julius file?

Sergiu Starciuc

unread,
Jun 23, 2022, 8:57:56 AM6/23/22
to Yesod Web Framework
Perhaps the Shakespearean module for TypeScript will help? (package shakespeare)

jsch...@gmail.com

unread,
Jun 23, 2022, 11:00:46 AM6/23/22
to Yesod Web Framework
Note that this line (from the Yesod Book) will only include .lucius, .cassius, .hamlet, and .julius files.

$(widgetFile "resource/index")

So you need to implement a custom function using the Text.TypeScript stuff linked above.

Alternatively (I would never copy & paste), you can write a Makefile that generates the .julius files from .ts files using tsc. And then just call make before you recompile your Yesod app.

kees Bleijenberg

unread,
Jun 26, 2022, 5:19:19 AM6/26/22
to Yesod Web Framework
Thank you for you answer. I use copy and paste because the resulting julius file has to contain compiled ts and javascript functions that return type safe url's. To create the code for these functions that return typesafe url's I use interpolation. In Typescript I declare these functions as external.  It seems difficult to me to merge both parts with make. But I'll give  the Typescript module a try.
Reply all
Reply to author
Forward
0 new messages