Docs
Data Imports
Built-in data plugins turn structured files and text files into Ruby modules with serializable default exports.
Built-In Data Formats
DataPlugin is the base for Klenods built-in data import plugins:
JsonPluginhandles.jsonwithJSON.parse.YamlPluginhandles.yamland.ymlwithYAML.safe_load.TomlPluginhandles.tomlwithTomlRB.parse.TextPluginhandles.txtand.textas strings.
Import Values
Data files transform into Ruby modules exporting Default. Development imports return the parsed value directly.
Metrics = import("./metrics.json")
Navigation = import("./navigation.yaml")
Release = import("./release.toml")
Note = import("./note.txt")
In runtime bundles, parsed data is serialized directly so production loading does not need the build plugin.
When To Use Data Imports
Use data imports for content and configuration that should participate in the dependency graph, invalidate on file changes, and serialize into runtime bundles. Use Ruby modules when the value needs Ruby behavior, dynamic computation, or explicit methods.