Skip to content

Commit

Permalink
Merge pull request #1436 from minrk/less-py-js-py-js-less
Browse files Browse the repository at this point in the history
add npm run build:css
  • Loading branch information
rgbkrk committed May 8, 2016
2 parents 0849f68 + f0352f6 commit 4ec76aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ before_install:
- git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels

install:
- npm run build
- pip install -f travis-wheels/wheelhouse file://$PWD#egg=notebook[test]

script:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"lint": "eslint --quiet notebook/",
"bower": "bower install --allow-root --config.interactive=false",
"build:watch": "concurrent \"npm run build:css:watch\" \"npm run build:js:watch\"",
"build": "npm run build:css && npm run build:js",
"build:css": "python setup.py css",
"build": "npm run build:js && npm run build:css",
"build:css": "concurrent 'npm run build:css:ipython' 'npm run build:css:style'",
"build:css:ipython": "lessc --include-path=notebook/static notebook/static/style/ipython.less notebook/static/style/ipython.min.css",
"build:css:style": "lessc --include-path=notebook/static notebook/static/style/style.less notebook/static/style/style.min.css",
"build:css:watch": "echo Not implemented yet...",
"build:js": "webpack",
"build:js:watch": "npm run build:js -- --watch"
Expand Down
26 changes: 7 additions & 19 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,29 +403,17 @@ def initialize_options(self):
def finalize_options(self):
pass

sources = []
targets = []
for name in ('ipython', 'style'):
sources.append(pjoin(static, 'style', '%s.less' % name))
targets.append(pjoin(static, 'style', '%s.min.css' % name))

def run(self):
self.run_command('jsdeps')
env = os.environ.copy()
env['PATH'] = npm_path

for src, dst in zip(self.sources, self.targets):
try:
run(['lessc',
'--source-map',
'--include-path=%s' % pipes.quote(static),
src,
dst,
], cwd=repo_root, env=env)
except OSError as e:
print("Failed to build css: %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr)
raise
try:
run(['npm', 'run', 'build:css'])
except OSError as e:
print("Failed to run npm run build:css : %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr)
raise
# update package data in case this created new files
update_package_data(self.distribution)

Expand Down Expand Up @@ -542,8 +530,8 @@ def run(self):
return

try:
self.distribution.run_command('css')
self.distribution.run_command('js')
self.distribution.run_command('css')
except Exception as e:
# refresh missing
missing = [ t for t in targets if not os.path.exists(t) ]
Expand Down

0 comments on commit 4ec76aa

Please sign in to comment.