run lessc via npm

This commit is contained in:
Min RK
2017-08-05 14:04:34 +02:00
parent 00a4aef607
commit 8a95066b2e
2 changed files with 4 additions and 5 deletions

View File

@@ -9,7 +9,8 @@
"url": "https://github.com/jupyter/jupyterhub.git" "url": "https://github.com/jupyter/jupyterhub.git"
}, },
"scripts": { "scripts": {
"postinstall": "./bower-lite" "postinstall": "./bower-lite",
"lessc": "lessc"
}, },
"devDependencies": { "devDependencies": {
"less": "^2.7.1", "less": "^2.7.1",

View File

@@ -219,17 +219,15 @@ class CSS(BaseCommand):
style_css = pjoin(static, 'css', 'style.min.css') style_css = pjoin(static, 'css', 'style.min.css')
sourcemap = style_css + '.map' sourcemap = style_css + '.map'
env = os.environ.copy()
env['PATH'] = npm_path
args = [ args = [
'lessc', '--clean-css', 'npm', 'run', 'lessc', '--', '--clean-css',
'--source-map-basepath={}'.format(static), '--source-map-basepath={}'.format(static),
'--source-map={}'.format(sourcemap), '--source-map={}'.format(sourcemap),
'--source-map-rootpath=../', '--source-map-rootpath=../',
style_less, style_css, style_less, style_css,
] ]
try: try:
check_call(args, cwd=here, env=env, shell=shell) check_call(args, cwd=here, shell=shell)
except OSError as e: except OSError as e:
print("Failed to run lessc: %s" % e, file=sys.stderr) print("Failed to run lessc: %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr) print("You can install js dependencies with `npm install`", file=sys.stderr)