Show More
@@ -3,11 +3,15 b'' | |||
|
3 | 3 | from fabric.api import local,lcd |
|
4 | 4 | from fabric.utils import abort |
|
5 | 5 | import os |
|
6 | from distutils.version import LooseVersion as V | |
|
7 | from subprocess import check_output | |
|
6 | 8 | |
|
7 | 9 | pjoin = os.path.join |
|
8 | 10 | static_dir = 'static' |
|
9 | 11 | components_dir = os.path.join(static_dir, 'components') |
|
10 | 12 | |
|
13 | min_less_version = '1.4.0' | |
|
14 | max_less_version = '1.5.0' # exclusive | |
|
11 | 15 | |
|
12 | 16 | def css(minify=True, verbose=False): |
|
13 | 17 | """generate the css from less files""" |
@@ -27,6 +31,16 b' def _compile_less(source, target, minify=True, verbose=False):' | |||
|
27 | 31 | verbose = _to_bool(verbose) |
|
28 | 32 | min_flag = '-x' if minify is True else '' |
|
29 | 33 | ver_flag = '--verbose' if verbose is True else '' |
|
34 | ||
|
35 | # pin less to 1.4 | |
|
36 | out = check_output(['lessc', '--version']) | |
|
37 | out = out.decode('utf8', 'replace') | |
|
38 | less_version = out.split()[1] | |
|
39 | if V(less_version) < V(min_less_version): | |
|
40 | raise ValueError("lessc too old: %s < %s" % (less_version, min_less_version)) | |
|
41 | if V(less_version) > V(max_less_version): | |
|
42 | raise ValueError("lessc too new: %s > %s" % (less_version, max_less_version)) | |
|
43 | ||
|
30 | 44 | with lcd(static_dir): |
|
31 | 45 | local('lessc {min_flag} {ver_flag} {source} {target}'.format(**locals())) |
|
32 | 46 |
General Comments 0
You need to be logged in to leave comments.
Login now