Clio modules

Any exported function in any .clio file can be imported in any other Clio file.

The above example is a simple Clio module and can be imported and used like this:

In Clio, imports are relative and by path, there is no support for absolute imports. Clio recognises the following import path formats:

Including .clio for file name is optional, the above example is the same as the following:

You can also import a directory, if there is a main.clio file in it:

External Clio Dependencies

To install a package from the Clio package registry, you can run:

clio deps add <package-name>

this will add the package as a dependency in your manifest, fetch the package and store it inside the .clio/modules directory at the root of your project. If you want to fetch the packages listed in your project manifest file, you can run:

clio deps get

When the project is compiled, the dependencies inside your .clio/modules directory will be compiled and linked to your build.

Clio modules are installed from git. To install a dependency, you need to pass a git url and a tag, commit hash or branch name:

clio deps add
clio deps add
clio deps add

Multiple versions of a dependency can be installed and used at the same time, to import a dependency you need to use the tag, commit hash, or branch name used to install it: