Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Define a main file and only compile the main file. #328

Closed
SebastianJL opened this issue Oct 20, 2023 · 5 comments
Closed

Define a main file and only compile the main file. #328

SebastianJL opened this issue Oct 20, 2023 · 5 comments

Comments

@SebastianJL
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the discussions and believe that my question is not already covered.

Feature Request

It would be really nice if it would be possible to define a main file per project.

  • The lsp would only compile the main file.
  • The lsp would recompile the main file on changes of #included or #imported files.

At the moment if I write for example a template.typ file it will be compiled on save. This just results in an empty pdf which is useless. In turn I will have to change back to my main.typ and save it manually to see the changes in my template.typ take effect.

I would also suggest that if there is a main.typ in the root folder that it will be recognized as the main file by default. Or is there a more common filename for the main file? Maybe there is also some other mechanism from which the main file could be deteremined.

@SebastianJL
Copy link
Author

I'm very new to typst, so please excuse if something about the request is stupid.

@DaAlbrecht
Copy link

Hey i think that there is no solution for this at the moment. Its related to this issue i think: #285

my workflow at the moment is just to use the typst cli watch command on your "main" file:

typst watch <filename>  

Additionally there seems to be an issue in disabling the lsp to generate a pdf: #265

To work around this i just add *.pdf to my .gitignore

Hope that helps

@SebastianJL
Copy link
Author

Thanks for the answer and the link to the other issue.
You're tip helps for not generating empty files but it won't recompile the main file on changing the template file.

@DaAlbrecht
Copy link

hm as long as the template is included in "main" it should work.
Could you maybe provide an example setup?

@SebastianJL
Copy link
Author

SebastianJL commented Oct 25, 2023

hm as long as the template is included in "main" it should work. Could you maybe provide an example setup?

Ah sorry, my bad. I didn't try it out, I just read the help

$typst watch --help
Watches an input file and recompiles on changes

and inferred from that that it wouldn't recompile on changes of imported files.

Well thanks a lot for the help. I'll close since there is already another issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants