kasperl
01/22/2025, 8:05 AMkasperl
01/22/2025, 8:06 AMkasperl
01/22/2025, 8:10 AMjag.defines asset.kasperl
01/22/2025, 8:15 AMjag run -D mypage.greeting="hello" myapp.toit, you can use the "hello" string from myapp.toit like this:
import system.assets
main:
jag-defines := assets.decode["jag.defines"]
greeting := jag-defines["mypage.greeting"]
print "greeting = $greeting"kasperl
01/22/2025, 8:17 AMjag run --asset file:mypage=mypage.html myapp.toit, perhaps. That could then be used from Toit code like this: assets.decode["mypage"].kasperl
01/22/2025, 8:36 AM--assets option. To use this, you first have to produce an assets file using toit tool assets.kasperl
01/22/2025, 8:38 AMtoit tool assets -e myassets create
and then you add you assets to it like this:
toit tool assets -e myassets add mypage mypage.htmlkasperl
01/22/2025, 8:39 AMmyassets that has a single entry (mypage) that contains the content of the mypage.html file.kasperl
01/22/2025, 8:39 AMtoit tool assets -e myassets listkasperl
01/22/2025, 8:41 AMjag run --assets myassets myapp.toit and you can access your html like this:
import system.assets
main:
mypage := assets.decode["mypage"]
print "html = $mypage"kasperl
01/22/2025, 8:42 AMtoit executable in $HOME/.cache/jaguar/sdk/bin/toit.