diff --git a/README.md b/README.md index 90848a71..aa30dca3 100644 --- a/README.md +++ b/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.