oi-lume-utils

Useful utilities for the Lume SSG

loaders

csv-loader

Usage:

import csvLoader from 'https://cdn.jsdelivr.net/gh/open-innovations/oi-lume-utils@<version>/loaders/csv-loader.ts';

site.loader(['.csv'], csvLoader);

TODO - Documentation!

processors

This library includes a series of processors for use in Lume.

auto-dependency

Adds script headers to generated pages based on the inclusion of data-dependencies attributes. Each dependency is only included once.

Annotations such as this:

<div data-dependencies='/js/optional-script.js'>...</div>

or to specify multiple dependencies

<div data-dependencies='/js/optional-script.js, /js/another-script.js'>...</div>

Will result in the following being added to the head

<script src='/js/optional-script.js' data-auto-dependency=true></script>

To configure this procesor, add the following to _config.js (or _config.ts, if you're that way inclined).

import autoDependency from 'https://cdn.jsdelivr.net/gh/open-innovations/oi-lume-utils@<version>/processors/auto-dependency.ts';

site.process(['.html'], autoDependency)

NB - if you are using the base_path plugin, make sure that is loaded after this processor, so any local absolute script URLs are properly transformed.