Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim down package #54

Open
joshuadavidthomas opened this issue Mar 23, 2024 · 2 comments
Open

Slim down package #54

joshuadavidthomas opened this issue Mar 23, 2024 · 2 comments

Comments

@joshuadavidthomas
Copy link
Member

joshuadavidthomas commented Mar 23, 2024

IMO, this package is a bit heavy for what it does -- provide an easy way to use Heroicons throughout your Wagtail admin. Odds are, someone doesn't need ALL the heroicons at their disposal, just a handful of either specific icons or just a specific style. Right now this package includes all of the heroicons for every style which adds roughly 2 MB to the package.

wagtail-heroicons/src/wagtail_heroicons on  main [$]  v3.12.1 (heroicons-3.12) 
➜ du -h
932K    ./templates/wagtail_heroicons/solid
932K    ./templates/wagtail_heroicons/outline
1.9M    ./templates/wagtail_heroicons
1.9M    ./templates
1.9M    .

This will be further exacerbated when we start using Heroicons v2 (#48) as it has not two, but four different styles of icons. So it could go to up as much as 4 or 5 MB just for the SVG templates alone.

We could either go the route described in #29 and have a different namespace package for each icon style and have them installable via extras -- python -m pip install wagtail-heroicons[solid] OR we could provide a way to opt in somehow to selecting individual icons. Perhaps a management command that allows someone to specifically select an icon to download and have it put in the templates directory of the user's project (or wherever they want it).

@joshuadavidthomas
Copy link
Member Author

Alternatively, as also discussed in #29, we could write a template loader that can load templates from a zip file and use https://github.com/adamchainz/heroicons for the icons, since that's how that package provides the icons. Obviously this would be a bit more complex, and would require the user to add the template loader to their settings, but it's something to think about.

@joshuadavidthomas
Copy link
Member Author

Though looking at django-template-partials source, it doesn't seem too difficult -- https://github.com/carltongibson/django-template-partials/blob/main/src/template_partials/loader.py

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

No branches or pull requests

1 participant