mirror of
https://github.com/django-components/django-components.git
synced 2025-09-09 07:30:31 +00:00
Update readme (thanks @mohammedalhaddar).
This commit is contained in:
parent
458b5383e0
commit
f87f87dadf
1 changed files with 35 additions and 2 deletions
37
README.md
37
README.md
|
@ -3,11 +3,44 @@
|
|||
A way to create simple reusable template components in Django.
|
||||
|
||||
# Installation
|
||||
```pip install django-components``` (NOTE: Does not work yet)
|
||||
|
||||
Install the app into your environment:
|
||||
|
||||
> ```pip install git+https://github.com/EmilStenstrom/django-components.git#egg=django_components```
|
||||
|
||||
Then add the app into INSTALLED APPS in settings.py
|
||||
|
||||
```
|
||||
INSTALLED_APPS = [
|
||||
...,
|
||||
"django_components",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
## Optional
|
||||
|
||||
To avoid loading the app in each template using ``` {% load django_components %} ```, you can add the tag as a 'builtin' in settings.py
|
||||
|
||||
```
|
||||
TEMPLATES = [
|
||||
{
|
||||
...,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
...
|
||||
],
|
||||
'builtins': [
|
||||
'django_components.templatetags.component_tags',
|
||||
]
|
||||
},
|
||||
},
|
||||
]
|
||||
```
|
||||
|
||||
# Create your first component
|
||||
|
||||
A component in django-components is the combination of four things: CSS, Javascript, a Django template, and some Python code to put them all together.
|
||||
A component in django-components is the combination of four things: CSS, Javascript, a Django template, and some Python code to put them all together.
|
||||
|
||||
First you need a CSS file. Be sure to prefix all rules with a unique class so they don't clash with other rules.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue