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.6a0.tar.gz (6.7 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.6a0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: touchable_templates-2026.2.6a0.tar.gz
  • Upload date:
  • Size: 6.7 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.6a0.tar.gz
Algorithm Hash digest
SHA256 5f7232122dee44e3134ebd5ababc1ef4f33280e555dbdb8cc8fc614e5855b853
MD5 37f11037eca6609883986b8e7542ffa7
BLAKE2b-256 d5aa0647790abebacf11a3b80c54d0a22cb94cf196c258a59e63c10e7c449ec2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: touchable_templates-2026.2.6a0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.6a0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbbc0622c522377201dbc6e698065fc7a2e55a9a26ac59ed45f813cee6e99721
MD5 5636ba17c2469e455632405594bd3299
BLAKE2b-256 7203b64b644fa57242e5112562cdc8a87b505a1a717561543e0794a4ddb7c6de

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