mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
don’t store minified css in development
- setup css defaults to non-minified css - build minified css and jsversion on sdist/wheel
This commit is contained in:
parent
2fe0687097
commit
0eae787b58
2
IPython/html/fabfile.py
vendored
2
IPython/html/fabfile.py
vendored
@ -13,7 +13,7 @@ components_dir = os.path.join(static_dir, 'components')
|
||||
min_less_version = '1.7.0'
|
||||
max_less_version = '1.8.0' # exclusive
|
||||
|
||||
def css(minify=True, verbose=False):
|
||||
def css(minify=False, verbose=False):
|
||||
"""generate the css from less files"""
|
||||
for name in ('style', 'ipython'):
|
||||
source = pjoin('style', "%s.less" % name)
|
||||
|
5
setup.py
5
setup.py
@ -72,6 +72,7 @@ from setupbase import (
|
||||
get_bdist_wheel,
|
||||
CompileCSS,
|
||||
JavascriptVersion,
|
||||
css_js_prerelease,
|
||||
install_symlinked,
|
||||
install_lib_symlink,
|
||||
install_scripts_for_symlink,
|
||||
@ -228,7 +229,7 @@ class UploadWindowsInstallers(upload):
|
||||
|
||||
setup_args['cmdclass'] = {
|
||||
'build_py': check_package_data_first(git_prebuild('IPython')),
|
||||
'sdist' : git_prebuild('IPython', sdist),
|
||||
'sdist' : css_js_prerelease(git_prebuild('IPython', sdist)),
|
||||
'upload_wininst' : UploadWindowsInstallers,
|
||||
'submodule' : UpdateSubmodules,
|
||||
'css' : CompileCSS,
|
||||
@ -302,7 +303,7 @@ if 'setuptools' in sys.modules:
|
||||
# setup.py develop should check for submodules
|
||||
from setuptools.command.develop import develop
|
||||
setup_args['cmdclass']['develop'] = require_submodules(develop)
|
||||
setup_args['cmdclass']['bdist_wheel'] = get_bdist_wheel()
|
||||
setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(get_bdist_wheel())
|
||||
|
||||
setuptools_extra_args['zip_safe'] = False
|
||||
setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
|
||||
|
27
setupbase.py
27
setupbase.py
@ -25,7 +25,7 @@ from distutils.command.install_scripts import install_scripts
|
||||
from distutils.cmd import Command
|
||||
from fnmatch import fnmatch
|
||||
from glob import glob
|
||||
from subprocess import call
|
||||
from subprocess import check_call
|
||||
|
||||
from setupext import install_data_ext
|
||||
|
||||
@ -666,16 +666,22 @@ class CompileCSS(Command):
|
||||
Requires various dev dependencies, such as fabric and lessc.
|
||||
"""
|
||||
description = "Recompile Notebook CSS"
|
||||
user_options = []
|
||||
user_options = [
|
||||
('minify', 'x', "minify CSS"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
self.minify = False
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
self.minify = bool(self.minify)
|
||||
|
||||
def run(self):
|
||||
call("fab css", shell=True, cwd=pjoin(repo_root, "IPython", "html"))
|
||||
check_call("fab css:minify=%s" % self.minify,
|
||||
shell=True,
|
||||
cwd=pjoin(repo_root, "IPython", "html"),
|
||||
)
|
||||
|
||||
|
||||
class JavascriptVersion(Command):
|
||||
"""write the javascript version to notebook javascript"""
|
||||
@ -698,3 +704,14 @@ class JavascriptVersion(Command):
|
||||
line = 'IPython.version = "{0}";\n'.format(version)
|
||||
f.write(line)
|
||||
|
||||
|
||||
def css_js_prerelease(command):
|
||||
"""decorator for building js/minified css prior to a release"""
|
||||
class DecoratedCommand(command):
|
||||
def run(self):
|
||||
self.distribution.run_command('jsversion')
|
||||
css = self.distribution.get_command_obj('css')
|
||||
css.minify = True
|
||||
self.distribution.run_command('css')
|
||||
command.run(self)
|
||||
return DecoratedCommand
|
||||
|
Loading…
Reference in New Issue
Block a user