#wasm-text #ssg #text #static-site-generator #web

dollgen

an unopinionated and extensible Static Site Generator, natively supporting liquid, markdoll, scss, and compiling rust to wasm

1 unstable release

new 0.1.0 Nov 18, 2024

#324 in WebAssembly

Download history 132/week @ 2024-11-17

132 downloads per month

MIT license

26KB
479 lines

&dollgen dollgen is a relatively simple Static Site Generator, intended to be unbiased towards what you choose to write your site in (by default, it doesn't have [em:any] language-specific features)

&rules
	the core of dollgen is simple, define rules with the following:
	-	included paths[ref(glob)]
	-	excluded paths[ref(glob)]
	-	output path[ref(format)] (recieves captures from the include glob that matched)
	-	transformer the reads the input file and writes the output file
		-	the most basic transformer is [code:copy], literally defined as
			[codeblock(rust)::
				pub fn copy(src: PathBuf, dst: PathBuf, _: Vec<String>) -> Result<(), ErrorKind> {
					fs::copy(src, dst)?;
					Ok(())
				}
			]
		-	others may be created yourself or found in the [em:integrations] section
	
	although it's *recommended* to use [code:src/] for input files and [code:dist/] for output files,
	dollgen does not care what directories you use, and will automatically create directories up to whatever
	output path that a rule specifies

	[def(glob)::
		globs follow the syntax of [link(https://crates.io/crates/capturing-glob):capturing-glob]
		
		all paths are relative to the current working directory
	]

	[def(format)::
		format strings follow a similar syntax to rust's format strings, but simpler

		given a list of captures, [code:{n}] is replaced with the [code:n]-th capture

		given rule with an include [code:src/(**)/(*).draft.*)],
		matching path [code:src/blog/itsfirstblog.draft.doll],
		format string [code:dist/{0}/{1}.html]
		would produce [code:dist/blog/itsfirstblog.html]
	]

&integrations
	read more about integrations in their individual modules

	currently present
	-	[link(https://docs.rs/dollgen/latest/dollgen/liquid/):liquid]
		(feature: [code:liquid], support for [link(https://shopify.github.io/liquid/):the liquid templating language])
		-	[link(https://docs.rs/dollgen/latest/dollgen/liquid/markdoll/):liquid]
			(feature: [code:liquid-markdoll], support for [link(https://github.com/0x57e11a/markdoll):the markdoll language], tied into liquid)
	-	[link(https://docs.rs/dollgen/latest/dollgen/scss/):scss]
		(feature: [code:scss], support for [link(https://sass-lang.com/documentation/syntax/):the scss/sass stylesheet languages])
	-	[link(https://docs.rs/dollgen/latest/dollgen/wasm/):wasm]
		(feature: [code:wasm], support for compiling rust libs to [link(https://webassembly.org/):webassembly modules], via [link(https://github.com/rustwasm/wasm-bindgen):wasm_bindgen])

	planned
	-	markdown
	-	maybe MDX?
	-	maybe reStructuredText? (if it wants to subject itself to that?)
	-	at this point just make an issue for what you want

Dependencies

~0.5–12MB
~156K SLoC