Name: pattern-library
Owner: Springload
Description: WIP: Pattern library in django.
Created: 2016-03-23 05:01:41.0
Updated: 2017-07-03 00:04:34.0
Pushed: 2016-04-08 04:04:43.0
Homepage: null
Size: 123
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is some very initial thinking about how a pattern library could work.
The pattern library has two simple goals:
pip install -r requirements.txt
in the project root../manage.py runserver
http://localhost:8000
Use ./manage.py createcomponent my_app my_component
to scafold the basic structure under my_app/components/
In PROJECT/settings.py
:
patterns
to INSTALLED_APP
os.path.join(BASE_DIR, 'patterns', 'components')
to TEMPLATES['DIRS']
You load some data and pass it to a component.
This could be stored in a Python package:
omponent "button" data='example.conf.DEFAULT_BUTTON' %}
Or, set dynamically in the template:
ptions button_data %}
"class": [
"btn",
"btn-primary",
"btn-options"
],
"attrs": {
"data-button": "some-value"
},
"label": "{{ 'I changed the label' }}"
ndoptions %}
omponent "button" data=button_data %}
Or both:
oad_data "example.data.BUTTON_DATA" as common_data %}
ptions common_data button_data %}
"label": "{{ 'I changed the label' }}"
ndoptions %}
omponent "button" data=button_data %}
./manage.py startapp my_app
PROJECT/settings.py
:my_app
to INSTALLED_APP
before patterns
os.path.join(BASE_DIR, 'my__app', 'components')
to TEMPLATES['DIRS']
before os.path.join(BASE_DIR, 'patterns', 'components')