Docs
Plugin Reference
Built-in plugins cover Ruby, Haml, Markdown, CSS, JavaScript, assets, data imports, routing, and Google Fonts.
Default Plugin Set
Klenod::Build::Context.default_plugins includes RubyPlugin, IntlPlugin, HamlPlugin, MarkdownPlugin, CSSPlugin, JavaScriptPlugin, SvgPlugin, ImagePlugin, JsonPlugin, YamlPlugin, TomlPlugin, and TextPlugin.
RouterPlugin and GoogleFontsPlugin are built in but opt-in. Applications can configure either one explicitly when they need routing or Google Fonts imports.
Hook Phases
Plugins can implement:
resolve(dependency, context)to map an import specifier to a module id.load(module_id, context)to provide source for virtual or custom modules.transform(module_id, code, context)to rewrite source and record dependencies, assets, metadata, source maps, and watched patterns.finalize(module_id, result, resolved_dependencies, dependency_records, context)to adjust a transform after eager dependency records are collected.import_value(resolved_dependency, record, context)to provide development-time import values.runtime_import_value(resolved_dependency, record, context)to provide serialized bundle import values.
resolve, load, transform, and finalize are collection-time hooks. They must not depend on evaluated app exports. runtime_import_value must return serializable values or runtime instructions.
Core Plugins
RubyPluginRuby modules, import rewriting, lazy imports, glob imports, and runtime import values.HamlPluginHaml components, companion CSS, intl files, source maps, filters, and component tags.MarkdownPluginMarkdown files and Haml markdown filters rendered through application components.CSSPluginScoped CSS, stylesheet assets, CSS imports, class maps, and URL dependencies.JavaScriptPluginJavaScript, TypeScript, TSX custom elements, CSS module imports, asset metadata imports, source maps, and minification.Asset PluginsSVG and raster image imports with content types, dimensions, variants, and generated files.Data PluginsJSON, YAML, TOML, and text modules imported as Ruby values.IntlPluginTranslation companions for Haml modules.