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. Add the template loaders.
TEMPLATES = [
    {
        # ...
        "OPTIONS": {
            "loaders": [
                # "touchable_templates.django.loader.TouchableCottonLoader", # Uncomment if using django-cotton
                "touchable_templates.django.loader.TouchableTemplatesLoader",
                "touchable_templates.django.loader.TouchableTemplatesAppDirectoriesLoader",
                # ...
            ],
        },
    },
]
  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.8a0.tar.gz (6.9 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.8a0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: touchable_templates-2026.2.8a0.tar.gz
  • Upload date:
  • Size: 6.9 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.8a0.tar.gz
Algorithm Hash digest
SHA256 cc6e1b9fada70022532fe515d4e7d5e86f8aec63b9a1a9f32c74e138e11450b2
MD5 a825d2408bc1980bba02ca7082c056aa
BLAKE2b-256 2d65a6f503e20262b99dd62785c65c4e8217865eb2118d237293b5938c79a3db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: touchable_templates-2026.2.8a0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.8a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0beee639420f385fba3f9f0b26f57c3da383552d427cf7bcf821970367022521
MD5 8a37cfc556e0e20ee1ce58e71671662d
BLAKE2b-256 cf2be1b8615ed662e5eb1e916ffca31ab0c3748eab8bf8067d09b0e7b478d154

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