@@ -22,17 +22,122 @@ Pipeline is an asset packaging library for Django, providing both CSS and
22
22
JavaScript concatenation and compression, built-in JavaScript template support,
23
23
and optional data-URI image and font embedding.
24
24
25
+ .. image :: https://github.com/jazzband/django-pipeline/raw/master/img/django-pipeline.svg
26
+ :alt: Django Pipeline Overview
27
+
25
28
26
29
Installation
27
30
------------
28
31
29
- To install it, simply: ::
32
+ To install it, simply:
33
+
34
+ .. code-block :: bash
30
35
31
36
pip install django-pipeline
32
37
33
38
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
+
34
128
Documentation
35
129
-------------
36
130
37
- For documentation, usage, and examples, see :
131
+ For documentation, usage, and examples, see:
38
132
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 >`_.
0 commit comments