Skip to main content

jinja2-importmap

This package provides a simple tool for generating import maps from a directory in the usual node_modules format.

This can be done either from a directory, or from the contents of a Python package, for example if lists vendored JS dependencies in MANIFEST.in.

Use from Command Line

This package also provides a matching command line tool, jinja2_importmap:

$ jinja2_importmap demo/node_modules --prefix="url/prefix"                                                                                                                                                  19.7.0  jinja2-importmap
{
    "imports": {
        "codemirror": "url/prefix/codemirror/dist/index.js",
        "crelt": "url/prefix/crelt/index.es.js",
        ".yarn-integrity": "url/prefix/None",
        "w3c-keyname": "url/prefix/w3c-keyname/index.es.js",
        "@codemirror/lint": "url/prefix/@codemirror/lint/dist/index.js",
        "@codemirror/autocomplete": "url/prefix/@codemirror/autocomplete/dist/index.js",
        "@codemirror/language": "url/prefix/@codemirror/language/dist/index.js",
        "@codemirror/state": "url/prefix/@codemirror/state/dist/index.js",
        "@codemirror/search": "url/prefix/@codemirror/search/dist/index.js",
        "@codemirror/view": "url/prefix/@codemirror/view/dist/index.js",
        "@codemirror/commands": "url/prefix/@codemirror/commands/dist/index.js",
        "style-mod": "url/prefix/style-mod/src/style-mod.js",
        "@lezer/highlight": "url/prefix/@lezer/highlight/dist/index.js",
        "@lezer/common": "url/prefix/@lezer/common/dist/index.js",
        "@lezer/lr": "url/prefix/@lezer/lr/dist/index.js"
    }
}%

You can also equivalently use python -m jinja2_importmap to run the tool, or import jinja2_importmap.core.scan_packages for use in your own code.

Use from Jinja Template

Currently, a custom parsed tag is not yet implemented. However, loading the jinja2_importmap.ext.importmapextension will currently add importmap (an alias to scan_packages) to the global namespace.

{{ importmap("web/static/vendor", package="my_package", prefix="static") }}

The intention is to eventually provide:

{% importmap "web/static/vendor" package="my_package" prefix="static" %}

...or to allow overrides within a block:

{% importmap "web/static/vendor" package="my_package" prefix="static" %}
    {# override automatically generated importmap with json provided here #}
{% endimportmap %}

Metadata

Release files for jinja2-importmap 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jinja2-importmap 0.2.4
File Size Uploaded Provenance Actions
jinja2-importmap-0.2.4.tar.gz 12.9 kB Without provenance Details for jinja2-importmap-0.2.4.tar.gz

Release files / jinja2-importmap-0.2.4.tar.gz

Download URL jinja2-importmap-0.2.4.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
359ed1a953972234fa51cc574de8fe5c15ae951ca4c4f538ec57b53496fbcabd
BLAKE2b-256 checksum
How to use checksums
c984986dba718eec112ea37ae36c1b0d3597dd9010361b72ecaf3806fee7a1a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for jinja2-importmap 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page