Skip to content

Commit b638b7a

Browse files
committed
Update README to add overview image and quick start
1 parent 52b8024 commit b638b7a

File tree

3 files changed

+228
-2
lines changed

3 files changed

+228
-2
lines changed

HISTORY.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ History
66
Unreleased
77
==========
88

9+
* Update README.rst and add Pipeline overview image
10+
11+
912
2.0.9
1013
=====
1114

README.rst

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,122 @@ Pipeline is an asset packaging library for Django, providing both CSS and
2222
JavaScript concatenation and compression, built-in JavaScript template support,
2323
and optional data-URI image and font embedding.
2424

25+
.. image:: https://github.com/jazzband/django-pipeline/raw/master/img/django-pipeline.svg
26+
:alt: Django Pipeline Overview
27+
2528

2629
Installation
2730
------------
2831

29-
To install it, simply: ::
32+
To install it, simply:
33+
34+
.. code-block:: bash
3035
3136
pip install django-pipeline
3237
3338
39+
Quickstart
40+
-------
41+
42+
Pipeline compiles and compress your assets files from
43+
``STATICFILES_DIRS`` to your ``STATIC_ROOT`` when you run Django's
44+
``collectstatic`` command.
45+
46+
These simple steps add Pipeline to your project to compile multiple ``.js`` and
47+
``.css`` file into one and compress them.
48+
49+
Add Pipeline to your installed apps:
50+
51+
.. code-block:: python
52+
53+
# settings.py
54+
INSTALLED_APPS = [
55+
...
56+
'pipeline',
57+
]
58+
59+
60+
Use Pipeline specified classes for ``STATICFILES_FINDERS`` and ``STATICFILES_STORAGE``:
61+
62+
.. code-block:: python
63+
64+
STATICFILES_STORAGE = 'pipeline.storage.PipelineManifestStorage'
65+
66+
STATICFILES_FINDERS = (
67+
'django.contrib.staticfiles.finders.FileSystemFinder',
68+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
69+
'pipeline.finders.PipelineFinder',
70+
)
71+
72+
73+
Configure Pipeline:
74+
75+
.. code-block:: python
76+
77+
# The folowing config merges CSS files(main.css, normalize.css)
78+
# and JavaScript files(app.js, script.js) and compress them using
79+
# `yuglify` into `css/styles.css` and `js/main.js`
80+
# NOTE: Pipeline only works when DEBUG is False
81+
PIPELINE = {
82+
'STYLESHEETS': {
83+
'css_files': {
84+
'source_filenames': (
85+
'css/main.css',
86+
'css/normalize.css',
87+
),
88+
'output_filename': 'css/styles.css',
89+
'extra_context': {
90+
'media': 'screen,projection',
91+
},
92+
},
93+
},
94+
'JAVASCRIPT': {
95+
'js_files': {
96+
'source_filenames': (
97+
'js/app.js',
98+
'js/script.js',
99+
),
100+
'output_filename': 'js/main.js',
101+
}
102+
}
103+
}
104+
105+
106+
Then, you have to install compilers and compressors binary manually.
107+
108+
For example, you can install them using `NPM <https://www.npmjs.com/>`_
109+
and address them from ``node_modules`` directory in your project path:
110+
111+
.. code-block:: python
112+
113+
PIPELINE.update({
114+
'YUGLIFY_BINARY': path.join(BASE_DIR, 'node_modules/.bin/yuglify'),
115+
})
116+
# For a list of all supported compilers and compressors see documentation
117+
118+
119+
Load static files in your template:
120+
121+
.. code-block::
122+
123+
{% load pipeline %}
124+
{% stylesheet 'css_files' %}
125+
{% javascript 'js_files' %}
126+
127+
34128
Documentation
35129
-------------
36130

37-
For documentation, usage, and examples, see :
131+
For documentation, usage, and examples, see:
38132
https://django-pipeline.readthedocs.io
133+
134+
135+
Issues
136+
------
137+
You can report bugs and discuss features on the `issues page <https://github.com/jazzband/django-pipeline/issues>`_.
138+
139+
140+
Changelog
141+
---------
142+
143+
See `HISTORY.rst <https://github.com/jazzband/django-pipeline/blob/master/HISTORY.rst>`_.

img/django-pipeline.svg

Lines changed: 118 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)