Skip to content

Commit 30a481f

Browse files
committed
create barebones templatetags
1 parent ff7ec1c commit 30a481f

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

src/django_idom/static/js/idom.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Build.js is going to need to be moved here via your deployment scripts
2+
// This will allow developers to import IDOM the Django way
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- The importable IDOM JS -->
2+
<script src="{% static 'js/idom.js' %}" crossorigin="anonymous"></script>
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!-- Allows for making the IDOM root object the Django way
2+
Developers will often opt not to use this,
3+
but having this makes getting started a little bit easier to explain -->
4+
<div id="{{ html_id }}"></div>

src/django_idom/templatetags/__init__.py

Whitespace-only changes.

src/django_idom/templatetags/tags.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from django import template
2+
from django.urls import reverse
3+
4+
5+
register = template.Library()
6+
7+
# Template tag that renders the IDOM scripts
8+
@register.inclusion_tag("idom/head_content.html")
9+
def idom_scripts():
10+
pass
11+
12+
# Template tag that renders an empty idom root object
13+
@register.inclusion_tag("idom/root.html")
14+
def idom_root(html_id):
15+
return {"html_id": html_id}

0 commit comments

Comments
 (0)