www_duniayetu/run.vsh
2023-12-05 19:03:18 +03:00

34 lines
921 B
GLSL

#!/usr/bin/env -S v
import freeflowuniverse.webcomponents.preprocessor
import freeflowuniverse.webcomponents.tailwind
import vweb
import os
pub struct App {
vweb.Context
}
fn main() {
cp_all('${dir(@FILE)}/content', '${dir(@FILE)}/tmp_content', true)!
preprocessor.preprocess('${os.dir(@FILE)}/content')!
rmdir_all('public')!
rmdir_all('static/css')!
execute('./tailwindcss -i css/index.css -o ./static/css/index.css --minify')
execute('zola build')
execute('rsync -a ${dir(@FILE)}/tmp_content/ ${dir(@FILE)}/content/')
rmdir_all('${dir(@FILE)}/tmp_content')!
mut app := App{}
app.mount_static_folder_at('${dir(@FILE)}/public', '/')
vweb.run(&app, 8089)
}
['/:path...']
pub fn (mut app App) index(path string) vweb.Result {
if !path.ends_with('.html') {
return app.html(read_file('./public${path}/index.html') or {panic(err)})
}
return app.html(read_file('./public/index.html') or { panic(err) })
}