Skip to content

Commit f3e69d6

Browse files
committed
Update README.md
1 parent 88a9b65 commit f3e69d6

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a python script for automated merge and minify of JS and CSS files.
55

66
Optionally it can parse django template tags embeded into css and js files.
77

8-
And, if you have [lesscpy](https://github.com/lesscpy/lesscpy) installed you can compiled .LESS to .CSS defore merging.
8+
And, if you have [lesscpy](https://github.com/lesscpy/lesscpy) installed, you can compiled .LESS to .CSS defore merging.
99

1010
Example with a django project
1111
-----------------------------
@@ -35,7 +35,8 @@ On my base.html template I usually have something like this:
3535

3636
<!-- js -->
3737
{% if debug %}
38-
<script type="text/javascript" src="{% static 'js/less-1.6.2.min.js' %}"></script> <!-- while debugging less -->
38+
<!-- you need this only while debugging with less files -->
39+
<script type="text/javascript" src="{% static 'js/less-1.6.2.min.js' %}"></script>
3940
<script src="{% static 'js/code1.js' %}"></script>
4041
<script src="{% static 'js/code2.js' %}"></script>
4142
<script>
@@ -52,6 +53,7 @@ On my base.html template I usually have something like this:
5253
</head>
5354
```
5455

56+
Check this [github](https://github.com/less/less.js) for the less compiler at client side.
5557
Then simply put this script on the same directory as manager.py. Edit the script to adjust your paths to settings.py and to every JS and CSS you whant to merge/minify. Like:
5658

5759
```python
@@ -67,7 +69,8 @@ merger = {
6769
'tasks/templates/tasks/codentemplate.js',
6870
'message/templates/message/moretemplatecode.js',
6971
),
70-
#all static and rendered template JS will be merged, minified and saved to:
72+
#all static and rendered template JS will be merged,
73+
#minified and saved to:
7174
'jsmin': 'static/js/deploycode.min.js'
7275
},
7376

@@ -76,7 +79,8 @@ merger = {
7679
'less': ("message/static/message/css/message.less",
7780
"tasks/static/tasks/css/tasks.less"
7881
),
79-
#the static css and the css compiled from less files are merged, minified and saved to:
82+
#the static css and the css compiled from less files are
83+
#merged, minified and saved to:
8084
'cssmin': 'static/css/mydeploycss.min.css'
8185
},
8286

@@ -101,28 +105,34 @@ Once you update the work copy of your django project on your server all you have
101105

102106
```bash
103107
$python jscssmin.py
108+
Processing block: compact
109+
Compiling LESS: tasks/static/tasks/css/compactform.less
110+
Saving: tasks/static/tasks/css/compactform.css (0.17kB)
111+
104112
Processing block: my css
105113
Merging: tasks/static/tasks/css/fixtypeahead.css
106-
Merging: message/static/message/css/message.css
107-
Saving: static/css/ceco.css (2.28kB)
108-
Minifying CSS... Final: 73.7%
109-
Saving: static/css/ceco.min.css (1.68kB)
114+
Compiling LESS: message/static/message/css/message.less
115+
Compiling LESS: tasks/static/tasks/css/tasks.less
116+
Full merged size: 2.66kB
117+
Minifying CSS... Final: 72.7%
118+
Saving: static/css/mydeploycss.min.css (1.93kB)
110119

111120
Processing block: my js
112-
Merging: static/js/ceco.js
113-
Merging: static/js/xvalidator.js
114-
Merging template: tasks/templates/tasks/tasks.js
115-
Merging template: tasks/templates/tasks/cecomap.js
116-
Merging template: message/templates/message/message.js
117-
Saving: static.js.ceco.js (29.17kB)
118-
Minifying JS... Final: 50.3%
119-
Saving: static.js.ceco.min.js (14.67kB)
121+
Merging: static/js/code1.js
122+
Merging: static/js/code2.js
123+
Merging template: tasks/templates/tasks/code3template.js
124+
Merging template: tasks/templates/tasks/codentemplate.js
125+
Merging template: message/templates/message/moretemplatecode.js
126+
Full merged size: 34.66kB
127+
Minifying JS... Final: 50.1%
128+
Saving: static/js/deploycode.min.js (17.35kB)
129+
120130

121131
$python manage.py collectstatic
122132
$touch /path/to/yourwsgi.wsgi
123133
```
124134

125-
Ok, this can change on your server but that's the overall idea...
135+
Ok, this least step can change on your server, but that's the overall idea...
126136

127137
Also you can use the option *--images* to optimise **all** *.PNG* and *.JPG* present on the directory tree starting where you executed this script (usualy your django project root). Like:
128138

@@ -164,7 +174,7 @@ All four functions used above are only helper to call some online minifer api. S
164174
Minifier
165175
--------
166176

167-
This script uses some online api provided by [@andychilton] for all minify action:
177+
This script uses some great online api provided by [@andychilton] for all minify action:
168178
+ http://javascript-minifier.com
169179
+ http://cssminifier.com
170180
+ http://pngcrush.com

0 commit comments

Comments
 (0)