Skip to content

feature: hooks parameters#237

Draft
arnaudrocca wants to merge 7 commits intoraphaelameaume:devfrom
arnaudrocca:feature/hooks-parameters
Draft

feature: hooks parameters#237
arnaudrocca wants to merge 7 commits intoraphaelameaume:devfrom
arnaudrocca:feature/hooks-parameters

Conversation

@arnaudrocca
Copy link
Copy Markdown
Contributor

@arnaudrocca arnaudrocca commented Jan 16, 2026

Summary

This PR adds news parameters to Fragment's hooks in order to allow developers to generate and save custom files while matching Fragment sketches exporting logic.

Example

This code would result in saving a sketch.svg file after the capture of sketch.png, both in the same directory using the same filename pattern.

import { saveFiles } from '@fragment/utils/file.utils';

onAfterCapture(({ name, exportDir }) => {
	const data = draw(); // custom code to generate data (for example: SVG code using [d3-path](https://d3js.org/d3-path))

	const files = [
		{
			filename: `${name}.svg`,
			exportDir,
			data: data
		}
	];

	saveFiles(files);
});

@arnaudrocca arnaudrocca force-pushed the feature/hooks-parameters branch from ec197d5 to 6ddfcf8 Compare January 16, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant