Hello, I'm looking to create a personal website wi...
# javascript
s
Hello, I'm looking to create a personal website with kotlin serverside using ktor as well as Kotlin/JS. For this, I want to use minimal javascript for the website and instead server nearly entirely js-free webpages. But, there is also some (very minimal) dynamic content on the pages. For this, I'm using pebble templates with ktor, so ktor will process the templates and chuck out the html for the browser to read. This is done server side instead of client side. I want to keep this. Now, the problem I'm facing is this: I would like to also include some kotlin/js in the website, as well as bundle & process some other assets (like my style sheets which use SASS/SCSS, or a bunch of icons/images I want to minify & include) But to do this, I'm currently hard coding a name for the resulting javascript file and doing a bunch of
require
calls at the start of the kotlin main function. But, I want to add more assets as well as pages to the website. For this, I don't want to have to keep adding
require
calls to the start of my main
.kt
file. Instead, I'd like if webpack took my pebble template as input and used that to resolve assets. (But, there are some other assets, eg. icons, which must be processed even if not included in the source) What's the best way to go about this? I've had quite the difficulty in figuring out how I should do it. Also, I'm fine with moving to another templating language, but the templates need to be rendered server side and not by the javascript. I want clients that can't run javascript to be able to view a fully functioning page.
t
You may consider using React SSR, but it's still bit complicated with Kotlin. I don't think there are any publicly available examples, but I managed to get it working, so it's possible.