Package Links and Paths

When referring to files in your package, such as in a hyperlink or a <style> tag or <script> tag, simply use a relative path, and refer to the files in the same directory.

However often the need arises to refer from one package to another, for example when loading the base cockpit.js javascript. To do this the path must be crafted in a specific way: ../@@package@@/path

The @@package@@ is replaced by the relevant path component to address the the package. Put the package name between the @@ signs. It will be replaced with a cacheable checksum of the package, or qualified package name at the given host. Don't hardcode the path, use the @@ syntax.

For example here's how to include the base cockpit.js script in your HTML from the latest package:

  <script src="../@@latest@@"></script>

Do not assume you can link to any file in any other package. Refer to the list of API packages for those that are available for use.