ssg library
Bloom JS Native Static Site Generation (SSG) library.
This VM-only library provides static site rendering for Bloom JS Native applications.
It renders pre-configured routes to static HTML files, copies assets, and prepares
deployable bundles in dist/.
Example bin/ssg.dart usage:
import 'package:bloom_js_native/bloom_js_native.dart';
import 'package:bloom_js_native/ssg.dart';
void main() async {
final result = await generateStaticSite(
pages: {
'/': () => Div(text: 'Home page'),
'/about': () => Div(text: 'About page'),
},
title: 'My Bloom App',
titleFor: (path) => path == '/about' ? 'About Us' : 'Home',
);
print('Rendered ${result.pageCount} pages to dist/');
}
Classes
- SsgResult
- Summary of static site generation execution.
Functions
-
generateStaticSite(
{required Map< String, BloomNode Function()> pages, String outDir = 'dist', String webDir = 'web', String? title, String titleFor(String path)?, List<BloomNode> head = const [], List<String> stylesheets = const [], String lang = 'en', String appElementId = 'app', String mainScript = 'main.js', bool includeNpm = true, String bloomYamlPath = 'bloom.yaml'}) → Future<SsgResult> -
Generates a static site into
outDirfrom the suppliedpagesmap andwebDirassets.