chore: init docs

This commit is contained in:
Gabriel Dugny 2024-04-01 14:09:17 +02:00 committed by Emil Stenström
parent 899b9a2738
commit 163b0941c2
49 changed files with 1447 additions and 9 deletions

View file

@ -0,0 +1,22 @@
# Setting Up `ComponentDependencyMiddleware`
[`ComponentDependencyMiddleware`][django_components.middleware.ComponentDependencyMiddleware] is a Django middleware designed to manage and inject CSS/JS dependencies for rendered components dynamically. It ensures that only the necessary stylesheets and scripts are loaded in your HTML responses, based on the components used in your Django templates.
To set it up, add the middleware to your [`MIDDLEWARE`][] in settings.py:
```python
MIDDLEWARE = [
# ... other middleware classes ...
'django_components.middleware.ComponentDependencyMiddleware'
# ... other middleware classes ...
]
```
Then, enable `RENDER_DEPENDENCIES` in setting.py:
```python
COMPONENTS = {
"RENDER_DEPENDENCIES": True,
# ... other component settings ...
}
```