Open joshuadavidthomas opened 1 year ago
On second thought, for such a simple package, maybe writing a custom template loader would be overkill to mainly slim down the package.
I wonder if using extra packages would be another way to slim it down to only include the icons a person could want, e.g.:
pip install wagtail-heroicons[outline,solid] # for Heroicons v1.x
pip install wagtail-heroicons[mini,outline,solid] # for Heroicons v2.x
Native namespace packages is I think the right way to do this (probably), provided you can install them as extras. I think you can, but testing will need to be done to check.
Related to #28, in the
heroicon
package the icons are actually stored in a zip file to save space. This poses a problem for how Wagtail deals with SVG icons, as it expects the SVG to be a template somewhere where a template loader can find it.As far as I can tell, Django does not come with a way to load templates from a zip. We may need to write a custom one, utilizing
heroicons._load_icon
orheroicons._render_icon
in some way.https://docs.djangoproject.com/en/4.1/ref/templates/api/#custom-loaders