Closed ddahan closed 1 year ago
For now, the only solution I can think of would be to rewrite every tailwind icon, to make them look like a real Django template with variables that can be filled.
Yeah I have never used Django but this seems like a reasonable way to handle it if that's how things usually work there. We can't provide libraries for every framework under the sun unfortunately (I regret even creating the React/Vue libraries honestly), at the end of the day we are just providing some SVG icons and how you integrate those into your project is up to you.
Ok, fair enough :)
I was just expecting some magic workaround I didn't think of.
I'll build a django-heroicons
repo for that purpose.
Thanks.
Hi Tailwind team! In the documentation, it is stated:
However, I need lots of icons and can't afford filling my HTML with too many SVG attributes, as it makes the HTML longer and harder to read. That's why I decided to download all icon SVG files to include them as templates in Django.
Now to display an icon, I can write :
{% include 'heroicons/24/outline/archive-box-arrow-down.svg' %}
.However, this way, I have no way to modify svg attributes directly. For the icon size, a workaround can be to wrap it in a div (but it's a little ugly):
But for other attributes like
stroke-width
, it seems there's no way to modify them at all, as they should be directly on the<svg>
tag itself.Is there any elegant solution to this problem? For now, the only solution I can think of would be to rewrite every tailwind icon, to make them look like a real Django template with variables that can be filled. For example:
And then using icons like this:
I guess I would write such a script but I'd like to avoid useless work if there is another way. Thanks.