文件最后提交记录最后更新时间
20 天前
29 天前
20 天前
README

snapdom-plugin-template

A starter for SnapDOM v3 plugins. Replace the package name, description and example option with your own before publishing. See the plugin specification for capture hooks, custom exports and stage requirements.

Install

Install SnapDOM as a dev dependency:

npm install --save-dev @zumer/snapdom@latest

Scaffold a plugin from this template:

npx degit zumerlab/snapdom/packages/plugin-template snapdom-plugin-yourname
cd snapdom-plugin-yourname
npm install --save-dev @zumer/snapdom@latest

The template has no relative core dependency, so it works independently of the monorepo's directory layout. Keep the peer range aligned with the versions you test. The public installation notes and plugin specification track the released core.

Usage

import { snapdom } from '@zumer/snapdom';
import { myPlugin } from './index.js';

const result = await snapdom(element, {
  plugins: [myPlugin({ example: 'value' })]
});
const image = await result.toPng();

Options

Option Type Default Description
example string 'default' Describe this option

Hooks used

afterClone modifies the cloned DOM tree. The template's hook is empty until you add your implementation. Plugins can also add outputs such as HTML or structured context through defineExports.

License

MIT