Metadata-Version: 2.4
Name: lfp-importmap
Version: 0.2.0
Summary: Add JS importmaps to your Django project without Node or any other frontend tooling.
Project-URL: repository, https://github.com/SarthakJariwala/lfp-importmap
Author-email: Sarthak Jariwala <sarthak@sarthakjariwala.com>
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Requires-Dist: django-typer[rich]>=2.4.0
Requires-Dist: django>=4.2.16
Requires-Dist: httpx>=0.27.2
Description-Content-Type: text/markdown

# 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?

0. Install from pypi

```bash
uv add lfp-importmap
```

or

```bash
pythom -m pip install lfp-importmap
```

1. Add `lfp_importmap` to your `INSTALLED_APPS` in your `settings.py`

```python
INSTALLED_APPS = [
    ...
    'lfp_importmap',
]
```

2. Add any JS library using the new management command:

```bash
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.

3. In your `base.html` template, add the following:

```html
{% load lfp_importmap %}

<html>
  <head>
    ... {% javascript_importmap_tags %}
  </head>
  <body>
    ...
  </body>
</html>
```

4. 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:

```html
<button hx-get="{% url 'my-url-name' %}">Click me</button>
```

## LICENSE

MIT
