lemonsaurus / django-simple-bulma

Django application to add the Bulma CSS framework and its extensions
MIT License
136 stars 16 forks source link

Using multiple themes #86

Closed GDWR closed 1 year ago

GDWR commented 2 years ago

Currently, I attempting to use this project's multiple themes functionality to create a dark and light mode.

While trying to do this am I facing issues with sending duplicate .js files, as the tag has been used twice. With this .js being served twice, it is creating two event handlers for the navbar burger menu on the page and is causing it to stop working.

Django template:

{% bulma %}
{% bulma 'dark' %}

Firefox network tab when loading the page: image

I am unsure how Django extensions work, but having a way to ensure that only one .js file is served would allow me to implement the functionality I want.


This functionality for switching themes could be implemented into this package also, as it would be a nice to have for other users of django-simple-bulma

jchristgit commented 1 year ago

I believe in https://github.com/lemonsaurus/django-simple-bulma/blob/main/django_simple_bulma/templatetags/django_simple_bulma.py#L39 a condition would need to be added for only optionally including the JS files?

jchristgit commented 1 year ago

@lemonsaurus do you believe it would be sufficient to add a include_js flag to the tag and pass it as False?

lemonsaurus commented 1 year ago

Yes @jchristgit, that sounds totally fine. We could do that.

jchristgit commented 1 year ago

I opened #94 to implement it.