Add JS importmaps to your Django project without Node or any other frontend tooling.
Project description
lfp-importmap
A simple way to use Javascript importmaps in your Django projects.
What can you do with it?
Use Javascript libraries in your Django projects without having to install node and related frontend tooling like webpack, etc.
No frontend build system required!
How to use it?
- Install from pypi
uv add lfp-importmap
or
pythom -m pip install lfp-importmap
- Add
lfp_importmapto yourINSTALLED_APPSin yoursettings.py
INSTALLED_APPS = [
...
'lfp_importmap',
]
- Add any JS library using the new management command:
python manage.py importmap add htmx.org
This will create an importmap.config.json file in your project root.
It will also vendor the package code and make it available in your templates.
- In your
base.htmltemplate, add the following:
{% load lfp_importmap %}
<html>
<head>
... {% javascript_importmap_tags %}
</head>
<body>
...
</body>
</html>
- That's it! The module is now ready for use in your templates.
Continuing the example from above, you can now use the htmx module in your templates:
<button hx-get="{% url 'my-url-name' %}">Click me</button>
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 lfp_importmap-0.2.0.tar.gz.
File metadata
- Download URL: lfp_importmap-0.2.0.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
238e0e42baf4b77730dba89a24f2c802faf58ceb14c4f5119364bdba94efcf5c
|
|
| MD5 |
8e80009567ea92d467643c415238b275
|
|
| BLAKE2b-256 |
03b45abc438ec30690040fcb1b001b67090953335b8ba29c1d630be85963c64e
|
File details
Details for the file lfp_importmap-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lfp_importmap-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42afc2dfa2e000d96e0111e1a39858bd1e1820114b06b4d749f2f334def2f886
|
|
| MD5 |
50774051a9c2a6494be263610c31bbe2
|
|
| BLAKE2b-256 |
b059f573c614dadc3d2fbf85d22d7cdd777603a42ba7458df89bd18bbd75eebf
|