Best practice for sharing patterns or tags?

I know we can share a whole site for public use (I did so with my KDoc theme not too long ago), but what about when we have just a part of a site? Should it be copied into it’s own repo and documented somehow? Is there a way to share that will be easier of others to adopt? Should it be made into a plugin?

Real world example

I made a Kirbytext tag that allows the user to easily create gallery carousels. I think it’s pretty neat and I’d like to share. It consists of:
/site/tag/slider.php
Including a small JS library (lori.js)
A minimal bit of CSS

Thanks in advance for any advice or pointers.

You could make it into a plugin, that would make it easy to install, but the CSS and JS would have to be copied into assets and included in the site’ CSS/JS anyway by the user.

What about making a gist and sharing it in the solutions category?

@texnixe I guess it would be weird to have a plugin that has external dependencies.

@flokosiol I think this would work. It’s still not super clean/simple to integrate, but at lest the various bits could be made clear in one place. I’ll give this a try.

Thanks to you both for the suggestions.

It would be cool if there was an agreed-upon want to ingest patterns in a site. The patterns plugin is pretty close, but it doesn’t have a fixed opinion about CSS/JS. :thinking:

I think the gist idea works pretty cleanly, here is where I ended up posting it:

1 Like

You can export the CSS/JS from your plugin with a route and provide a helper function that will call the css() and js() functions with the correct route paths. This helper can then be used inside the snippets/templates.

Ah, ok - good to know. Do you happen to know if a plugin doing this currently that I could reference and learn from?

No, sorry. I have posted this approach before, but I don’t know if it was used anywhere.