Skip to content

Load Sources Plugin

A staticbolt plugin that registers entry points for the build pipeline. Once an entry point is registered, staticbolt finds and processes all of its dependencies on its own: scripts, stylesheets, and any other referenced file. You do not need to configure them.

Installation

The plugin ships as part of @staticbolt/core. You do not need to install anything else.

Usage

In your .staticbolt.ts configuration file:

The include option is required. It takes one or more glob patterns that point to your entry point files.

import { defineConfig } from "@staticbolt/core";
import { loadSourcesPlugin } from "@staticbolt/core/plugins";
export default defineConfig({
plugins: [
loadSourcesPlugin({
include: ["pages/**/*.html"],
}),
],
});

Any file type that staticbolt can process is a valid entry point, including HTML, JavaScript, CSS, and Markdown files.

loadSourcesPlugin({
include: ["pages/**/*.html", "scripts/worker.js", "styles/critical.css"],
});

Plugin Options

include

  • Type: string[]
  • Required

Glob patterns for the entry point files to register. Every matched file goes into the pipeline, and its dependencies are discovered from there.

exclude

  • Type: string[]
  • Default: []

Glob patterns for files to skip when matching entry points.

loadSourcesPlugin({
include: ["pages/**/*.html"],
exclude: ["pages/drafts/**"],
});