ItsEthra / typst-live

Hot reloading for your typst files
MIT License
82 stars 8 forks source link

Can not import module for templating #18

Open blackjyn opened 7 months ago

blackjyn commented 7 months ago

Thank you for creating this useful tool.

So, I create a template file called template.typ that contains settings for fonts, colors etc. The template is fine no errors. It is located at the root dir.

Then I tried to import the template to my page:

#import "../template.typ"

I encountered error with typst-live :

= hint: cannot read file outside of project root
= hint: you can adjust the project root with the --root argument

with typst w dir\src.typs --root="path\to\root" , it works just fine.

the --root arg is owned by typst but not typst-live.

perhaps we need a way to bypass args to the typst?

Thank you

ItsEthra commented 7 months ago

How do you launch typst-live and what arguments do you pass?

blackjyn commented 7 months ago

simply typst-live source.typ with no arguments

ItsEthra commented 7 months ago

Yea I guess one solution would be to separate typst and typst-live args with --, like cargo run does it, but I don't know how to do it with clap yet.

ItsEthra commented 7 months ago

With https://github.com/ItsEthra/typst-live/commit/cfdb60dbc9bff2b22e843e0abc139b9cc4e59c97 you should now be able to pass extra args like this typst-live file.typ -- --root=..., could you verify if it works?

malkoG commented 6 months ago

@ItsEthra It does not work

ItsEthra commented 6 months ago

Until I fix it I recommend using typst watch to output a pdf file which you can serve with typst-live -R

malkoG commented 6 months ago

Okay, sure. I'll use this command temporarily.

https://github.com/malkoG/dotfiles/blob/main/private_dot_config/mise/tasks/executable_typst