A dev tool that magically opens templates and partials in your IDE
Project description
touchable-templates
touchable-templates is a small developer helper that wraps rendered templates in a lightweight HTML marker and ships a tiny client-side script so you can, for example, click on a rendered component in the browser to automatically open the source template in your IDE.
This package is purposely minimal and designed to be installed into Django projects. Note: Future versions may support Jinja2, Flask, and other frameworks. This package is not intended to be used in production.
Key features
- Server-side wrapper for Django template responses (middleware)
- Small client-side script included as package static files
Installation
pip install
pip install touchable-templates
uv install
uv add touchable-templates
Django integration (quick start)
- Add the app to your
INSTALLED_APPSinsettings.py:
INSTALLED_APPS = [
# ...
"touchable_templates",
]
- Add the middleware so HTML responses are post-processed to convert wrapper containers
into elements with the
touchable-templatesclass (the client script uses that):
MIDDLEWARE = [
# ...
"touchable_templates.django.middleware.TouchableTemplatesMiddleware",
# ...
]
- Configure enablement and IDE mapping. You can set these via environment variables or
in
settings.py. Example (development):
# TOUCHABLE_TEMPLATES settings (example)
TOUCHABLE_TEMPLATES_ENABLE = True
TOUCHABLE_TEMPLATES_IDE = "vscode"
# Optional settings: Use if your project is dockerized or paths need adjustment
TOUCHABLE_TEMPLATES_ROOT = "/full/path/to/your/project/root/on/local/machine"
TOUCHABLE_TEMPLATES_REMOVE_PREFIX = "project/root/in/docker/container"
Supported IDEs
atomcodelitecursoremacsespressoideamacvimnetbeansnovapycharmsublimetextmatevscodevscode-insidersvscode-insiders-remotevscode-remotevscodiumxdebug
- Include the client JavaScript in your base template (requires
django.contrib.staticfiles): Add Script tag at the end of the body, or in the head.
{% load static %}
<script src="{% static 'js/touchable_templates.js' %}"></script>
Use
Press the alt or opt key to toggle the functionality on and off.
Moving your mouse around the page you will see a floating element indicating the template path/name
Click on any element on the page to open the corresponding template in your configured IDE.
Notes
- The middleware only processes responses with
Content-Type: text/htmlto ensure we are not processing json requests. - Make sure
TOUCHABLE_TEMPLATES_ENABLEisTruein development andFalsein production. - Use
TOUCHABLE_TEMPLATES_REMOVE_PREFIXto strip any leading path segments that are not part of the local filesystem path (e.g. if your project runs in a Docker container with a different root path).
Troubleshooting
- No overlay appears: verify
TOUCHABLE_TEMPLATES_ENABLEis True and the JS is loaded correctly (check browser devtools network tab). - Alt-click does nothing: ensure the HTML elements have
touchable-templatesclass (middleware unwraps container into children).
License
MIT License (MIT)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file touchable_templates-2026.2.5a0.tar.gz.
File metadata
- Download URL: touchable_templates-2026.2.5a0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ca51bc8c3a2084cde6ca76b38ce9eb28f5d911743f3c0d5cfc15f99f00db4d4
|
|
| MD5 |
83e787118f5d281fe75669e426371ded
|
|
| BLAKE2b-256 |
e1c2d2cccd8be2b9fef266760500974b053b6ca2d3ed86c557cca08a1dba07e3
|
File details
Details for the file touchable_templates-2026.2.5a0-py3-none-any.whl.
File metadata
- Download URL: touchable_templates-2026.2.5a0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7080057b975d0801810d12643d459476daf1b3bc3099c10cef1945070e36451c
|
|
| MD5 |
bb9b657f22adfc5027ab58e7606641ad
|
|
| BLAKE2b-256 |
7bcf7691a16af7ff91d0fe21d304ae79cd0e9a1e1463be943eea1f8fa92d76da
|