Skip to content

Template Dependencies

An Oicana template can use any Typst package. Public packages can be found in the Typst Universe. You can also install private packages locally and use them in Oicana templates. Using dependencies works just as for any other Typst document.

A locally installed package can have any namespace. A common one is @local, but feel free to use your company name or any other identifier. To install a local Typst package, you can use a community developed tool or manually copy files to the right place.

Typship is a tool for Typst package development and publishing. Its CLI can install local Typst packages for you. To install a package into the @local namespace, run typship install local in the package directory.

Installing a Typst package means that Typst can find it at {data-dir}/typst/packages/{namespace}/{name}/{version}. Here, {data-dir} is:

  • XDG_DATA_HOME or ~/.local/share on Linux
  • ~/Library/Application Support on macOS
  • %APPDATA% on Windows

For example, on Linux:

  1. Store a package in ~/.local/share/typst/packages/local/my-package/1.0.0
  2. Import all items from the package with #import "@local/my-package:1.0.0": * in a Typst document

For more information on packages, please refer to Typst’s packages repository.

When you run oicana pack, the CLI scans every .typ file in your template (and recursively inside each resolved package) for import statements with package specs, and copies the matching package sources into the archive. The result is a self-contained zip — at runtime, integrations resolve imports from the bundle, not from your local Typst cache or registry.

Packages land at .dependencies/<namespace>/<name>/<version>/ inside the archive. For example, a template that imports @preview/cetz:0.4.2 and @local/my-helpers:1.0.0 will contain .dependencies/preview/cetz/0.4.2/ and .dependencies/local/my-helpers/1.0.0/ next to the template’s own files.

How each package is sourced:

  • @preview packages are resolved from your local Typst cache, or downloaded from Typst Universe on the fly if missing.
  • Local packages (any other namespace, including @local) are resolved from {data-dir}/typst/packages/{namespace}/{name}/{version} on disk — the same directory described in Manual above.

If a package can’t be resolved — a local package that isn’t installed in the registry, or an @preview package whose download fails — oicana pack aborts with Failed to resolve package <spec> and writes no archive. That’s intentional: a partial archive could fail at runtime in production. Make sure every imported package is installed (or reachable from Typst Universe) before packing.