Skip to main content

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)

  1. Add the app to your INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
    # ...
  "touchable_templates",
]
  1. Add the middleware so HTML responses are post-processed to convert wrapper containers into elements with the touchable-templates class (the client script uses that):
MIDDLEWARE = [
    # ...
  "touchable_templates.django.middleware.TouchableTemplatesMiddleware",
    # ...
]
  1. 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

  • atom
  • codelite
  • cursor
  • emacs
  • espresso
  • idea
  • macvim
  • netbeans
  • nova
  • pycharm
  • sublime
  • textmate
  • vscode
  • vscode-insiders
  • vscode-insiders-remote
  • vscode-remote
  • vscodium
  • xdebug
  1. 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/html to ensure we are not processing json requests.
  • Make sure TOUCHABLE_TEMPLATES_ENABLE is True in development and False in production.
  • Use TOUCHABLE_TEMPLATES_REMOVE_PREFIX to 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).
  • Touchable-templates only processes templates that are part of your project. It skips templates that are part of third-party packages (e.g. in site-packages or dist-packages).

Troubleshooting

  • No overlay appears: verify TOUCHABLE_TEMPLATES_ENABLE is True and the JS is loaded correctly (check browser devtools network tab).
  • Alt-click does nothing: ensure the HTML elements have touchable-templates class (middleware unwraps container into children).

License

MIT License (MIT)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

touchable_templates-2026.2.7a0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

touchable_templates-2026.2.7a0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file touchable_templates-2026.2.7a0.tar.gz.

File metadata

  • Download URL: touchable_templates-2026.2.7a0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for touchable_templates-2026.2.7a0.tar.gz
Algorithm Hash digest
SHA256 da665b373d8c3d16df196ba3e689ba9bd2dc1705080c074a10a5d4d24b5c3210
MD5 021fac1645b31d23c59d43cd2b8497d4
BLAKE2b-256 7dfd035168222394feaaeac30c5324cc4ee204f8c2498586c6aa2e81e155a6e4

See more details on using hashes here.

File details

Details for the file touchable_templates-2026.2.7a0-py3-none-any.whl.

File metadata

  • Download URL: touchable_templates-2026.2.7a0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for touchable_templates-2026.2.7a0-py3-none-any.whl
Algorithm Hash digest
SHA256 73fd3d4ca10af2213c22c2cfd75848a3d52fbf7985b3892686c9a94a9d10118d
MD5 72540dbc53c0048bfdbc0a45739beef2
BLAKE2b-256 5dc158dc167f9e74b40f0811818e43871c9a4b26732584f1a01bc9b243825c7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page