Overview of Jinja templating in Static Shock
jinja Pub package. It is used to create dynamic content within text or HTML files by inserting values, executing loops, and running template behaviors.website·Indexed 32 days ago
https://staticshock.ioA static site generator for Dart. It features a plugin-based pipeline for transforming pages and assets, support for Markdown and Jinja templates, and built-in capabilities for compiling Sass and Tailwind CSS, generating RSS feeds, and deploying to GitHub Pages.
jinja Pub package. It is used to create dynamic content within text or HTML files by inserting values, executing loops, and running template behaviors.DataIndex is the primary mechanism for sharing data between pipeline steps, plugins, and page renderers (such as the Jinja page renderer). It is a hierarchical structure similar to a JSON object and is accessed via the StaticShockPipelineContext.WebsiteScreenshotsPlugin allows you to take screenshots of websites, save them as images, and display them in your generated website. This is particularly useful for creating showcase or portfolio sections.Static Shock uses a monorepo architecture containing multiple independent Dart packages. The project is divided into the following components:
static_shock: The core implementation used to build static sites.static_shock_cli: A command-line interface tool for generating, building, and testing Static Shock websites.static_shock_docs: The project's own documentation website, which is built using the Static Shock framework.Page is the primary data structure in Static Shock that eventually becomes a URL-addressable HTML page in the final static site build. Page objects are created by PageLoaders (e.g., a Markdown plugin creating a Page for every .md file) and can be modified by plugins that register a PageTransformer during the 'transform pages' step of the pipeline.The PagesIndex is a queryable data structure that stores all Page objects as they are loaded into the StaticShock pipeline. It allows plugins to retrieve and filter pages to perform site-wide operations. Common use cases include:
The PagesIndex is accessed via the StaticShockPipelineContext.
jinja package from Pub. Because it is a specific implementation, it may not support all features found in the original Python Jinja documentation. For full syntax specifications, refer to the official Jinja website.A plugin in Static Shock is a collection of configurations used to share functionality across projects. Plugins do not have special permissions; they simply organize code that configures the StaticShockPipeline. The pipeline processes source files into final static website build files using the following components:
Picker: Selects files/directories to enter the pipeline.DataLoader: Loads external data for page rendering.AssetTransformer: Transforms asset content (e.g., Sass to CSS).PageLoader: Identifies source files as pages and loads them into Page objects.PageTransformer: Modifies Page objects before rendering.PageRenderer: Renders Page objects to final HTML files.Finisher: Executes behavior after all pages are rendered.TailwindPlugin integrates with the Static Shock build phase by spawning a separate process to run the Tailwind CLI. It scans the files defined in tailwind.config.js, processes the input CSS file, and generates a single optimized CSS file containing only the classes used in the project.