mirror of https://github.com/zulip/zulip.git
webpack: Add --minify option to run-dev.py for to test minification.
This commit is contained in:
parent
1e5ce918e3
commit
28874cf26f
|
@ -55,6 +55,10 @@ parser.add_option('--test',
|
|||
action='store_true', dest='test',
|
||||
help='Use the testing database and ports')
|
||||
|
||||
parser.add_option('--minify',
|
||||
action='store_true', dest='minify',
|
||||
help='Minifies assets for testing in dev')
|
||||
|
||||
parser.add_option('--interface',
|
||||
action='store', dest='interface',
|
||||
default=None, help='Set the IP or hostname for the proxy to listen on')
|
||||
|
@ -186,7 +190,10 @@ if options.test:
|
|||
# for the Casper tests.
|
||||
subprocess.check_call('./tools/webpack')
|
||||
else:
|
||||
cmds += [['./tools/webpack', '--watch', '--port', str(webpack_port)]]
|
||||
webpack_cmd = ['./tools/webpack', '--watch', '--port', str(webpack_port)]
|
||||
if options.minify:
|
||||
webpack_cmd.append('--minify')
|
||||
cmds.append(webpack_cmd)
|
||||
for cmd in cmds:
|
||||
subprocess.Popen(cmd)
|
||||
|
||||
|
|
|
@ -25,11 +25,14 @@ def run():
|
|||
subprocess.check_call(['node', 'node_modules/.bin/webpack'] +
|
||||
['--config', 'tools/webpack.production.config.js', '-p'])
|
||||
|
||||
def run_watch(port):
|
||||
# type: (str) -> None
|
||||
def run_watch(port, minify):
|
||||
# type: (str, bool) -> None
|
||||
"""watches and rebuilds on changes, serving files from memory via webpack-dev-server"""
|
||||
subprocess.Popen(['node', 'node_modules/.bin/webpack-dev-server'] +
|
||||
['--config', 'tools/webpack.dev.config.js', '--watch-poll', '--port', port])
|
||||
webpack_args = ['node', 'node_modules/.bin/webpack-dev-server']
|
||||
webpack_args += ['--config', 'tools/webpack.dev.config.js', '--watch-poll', '--port', port]
|
||||
if minify:
|
||||
webpack_args.append('--optimize-minimize')
|
||||
subprocess.Popen(webpack_args)
|
||||
|
||||
def run_test():
|
||||
# type: () -> None
|
||||
|
@ -63,11 +66,14 @@ parser.add_argument('--watch',
|
|||
parser.add_argument('--port',
|
||||
action='store', dest='port',
|
||||
default='9994', help='set the port for the webpack server to run on')
|
||||
parser.add_argument('--minify',
|
||||
action='store_true', dest='minify', default=False,
|
||||
help='Minify and optimize the assets (for development)')
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.test:
|
||||
run_test()
|
||||
elif args.watch:
|
||||
run_watch(args.port)
|
||||
run_watch(args.port, args.minify)
|
||||
else:
|
||||
run()
|
||||
|
|
|
@ -67,7 +67,8 @@ ZULIP_ORG_KEY = get_secret("zulip_org_key")
|
|||
ZULIP_ORG_ID = get_secret("zulip_org_id")
|
||||
|
||||
if 'DEBUG' not in globals():
|
||||
# Uncomment end of next line to test JS/CSS minification.
|
||||
# Uncomment end of next line to test CSS minification.
|
||||
# For webpack JS minification use tools/run_dev.py --minify
|
||||
DEBUG = DEVELOPMENT # and platform.node() != 'your-machine'
|
||||
|
||||
if DEBUG:
|
||||
|
|
Loading…
Reference in New Issue