d

dovenv

@preview

Smoothly loads environment variables from dotenv (.env) files

v0.1.0
Apache-2.0

Package Information

Last Updated
Categories
textutilityscripting

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/dovenv:0.1.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/dovenv:0.1.0": *

Version History

0.1.0
ca2224d02427...

dovenv

dovenv (dove-env) is a zero-dependency module that smoothly loads environment variables from a .env file. It uses implementation and passes tests obtained from dotenv.

Examples

#import "@preview/dovenv:0.1.0": parse-env

// From single files
#assert.eq(parse-env(read(".env")), ("KEY": "VALUE"))

// From multiple files
#assert.eq(
  (".env", ".env.local").map(it => parse-env(read(it))).sum(),
  (KEY: "VALUE2", MORE_KEY: "VALUE3"),
)

License

This project is licensed under the Apache License 2.0.