forked from erdem/django-map-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
75 lines (61 loc) · 2.19 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from fabric.api import local
JS_FILE_MAPPING = {
"GooglePointFieldWidget": {
"input_files": [
"mapwidgets/static/mapwidgets/js/jquery_class.js",
"mapwidgets/static/mapwidgets/js/django_mw_base.js",
"mapwidgets/static/mapwidgets/js/mw_google_point_field.js",
],
"output_file": "mapwidgets/static/mapwidgets/js/mw_google_point_field.min.js"
},
"GooglePointFieldInlineWidget": {
"input_files": [
"mapwidgets/static/mapwidgets/js/jquery_class.js",
"mapwidgets/static/mapwidgets/js/django_mw_base.js",
"mapwidgets/static/mapwidgets/js/mw_google_point_field.js",
"mapwidgets/static/mapwidgets/js/mw_google_point_field_generater.js",
],
"output_file": "mapwidgets/static/mapwidgets/js/mw_google_point_inline_field.min.js"
}
}
CSS_FILE_MAPPING = {
"GooglePointFieldWidget": {
"input_files": [
"mapwidgets/static/mapwidgets/css/map_widgets.css",
],
"output_file": "mapwidgets/static/mapwidgets/css/map_widgets.min.css"
},
"GoogleStaticOverlayMapWidget": {
"input_files": [
"mapwidgets/static/mapwidgets/css/magnific-popup.css",
],
"output_file": "mapwidgets/static/mapwidgets/css/magnific-popup.min.css",
}
}
def minify_js_files():
"""
This command minified js files with UglifyJS
"""
for k, v in JS_FILE_MAPPING.items():
input_files = " ".join(v["input_files"])
output_file = v["output_file"]
uglifyjs_command = "uglifyjs {input_files} -o {output_file}".format(
input_files=input_files,
output_file=output_file
)
local(uglifyjs_command)
def minify_css_files():
"""
This command minified js files with UglifyCSS
"""
for k, v in CSS_FILE_MAPPING.items():
input_files = " ".join(v["input_files"])
output_file = v["output_file"]
uglifyjs_command = "uglifycss {input_files} > {output_file}".format(
input_files=input_files,
output_file=output_file
)
local(uglifyjs_command)
def minify_files():
minify_js_files()
minify_css_files()