2525from distutils .cmd import Command
2626from fnmatch import fnmatch
2727from glob import glob
28- from subprocess import call
28+ from subprocess import check_call
2929
3030from setupext import install_data_ext
3131
@@ -666,16 +666,22 @@ class CompileCSS(Command):
666666 Requires various dev dependencies, such as fabric and lessc.
667667 """
668668 description = "Recompile Notebook CSS"
669- user_options = []
669+ user_options = [
670+ ('minify' , 'x' , "minify CSS" ),
671+ ]
670672
671673 def initialize_options (self ):
672- pass
674+ self . minify = False
673675
674676 def finalize_options (self ):
675- pass
677+ self . minify = bool ( self . minify )
676678
677679 def run (self ):
678- call ("fab css" , shell = True , cwd = pjoin (repo_root , "IPython" , "html" ))
680+ check_call ("fab css:minify=%s" % self .minify ,
681+ shell = True ,
682+ cwd = pjoin (repo_root , "IPython" , "html" ),
683+ )
684+
679685
680686class JavascriptVersion (Command ):
681687 """write the javascript version to notebook javascript"""
@@ -697,4 +703,15 @@ def run(self):
697703 if line .startswith ("IPython.version" ):
698704 line = 'IPython.version = "{0}";\n ' .format (version )
699705 f .write (line )
700-
706+
707+
708+ def css_js_prerelease (command ):
709+ """decorator for building js/minified css prior to a release"""
710+ class DecoratedCommand (command ):
711+ def run (self ):
712+ self .distribution .run_command ('jsversion' )
713+ css = self .distribution .get_command_obj ('css' )
714+ css .minify = True
715+ self .distribution .run_command ('css' )
716+ command .run (self )
717+ return DecoratedCommand
0 commit comments