Skip to content

A VitePress plugin to preview your templ components while documenting them.

License

Notifications You must be signed in to change notification settings

indaco/vitepress-templ-preview

Repository files navigation

vitepress-templ-preview

A VitePress plugin to preview your templ components while documenting them.

NPM Package license

Documentation

Check out the docs here.

Contributing

We welcome contributions! Whether it's reporting a bug, suggesting a feature, or submitting a pull request, your input helps improve this project.

Known Issues

When running pnpm web:dev to start the sample website, you might encounter the following error:

> vitepress dev docs

failed to load config from <path>/vitepress-templ-preview/website/docs/.vitepress/config.mts
failed to start server. error:
Cannot find module '../data/patch.json'

Cause

This issue is related to the css-tree package. The root cause seems to stem from how module exports are defined in its package.json.

Workaround

You can resolve this issue by modifying the exports field in node_modules/css-tree/package.json. Specifically, update the first exports entry like so:

  "exports": {
    ".": {
-     "import": "./lib/index.js",
+     "import": "./cjs/index.cjs",
      "require": "./cjs/index.cjs"
    },
   ...

This workaround was discussed in bun/issues/13076.

Note

While this is a temporary fix, keep an eye on updates to css-tree or related dependencies for a permanent resolution. If you encounter additional issues or have insights into fixing this differently, feel free to open an issue!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

This project makes use of static-templ, which is licensed under the GNU General Public License (GPL). Users of this project must comply with the terms of the GPL license when using static-templ. Refer to the static-templ repository for more information on its licensing terms.