This works for me:
import std / os
const path = static:
"test" / "123.jpg"
import jsconsole
console.log path
Thanks assigning the the value of the code to const helped. Here is the code just in case anybody else needs it.
from tables import `[]=`, OrderedTable
from os import `/`, splitPath, parentDir, walkDir, PathComponent
from strutils import split, strip
const SVGS* : OrderedTable[string, string] = block :
var svgs : OrderedTable[string, string]
let assets_dir = currentSourcePath().parentDir() / "assets"
for file in walkDir(assets_dir):
if file.kind != pcFile:
continue
let
filename = file.path.splitPath().tail
split_filename = filename.split('.')
if split_filename[^1].strip() != "svg":
continue
svgs[split_filename[0]] = readFile(assets_dir / filename)
svgs