| Index: tools/js2c.py
|
| diff --git a/tools/js2c.py b/tools/js2c.py
|
| index d568556ebfcd7df11df10051188cb8ff7635b770..0ae1ad91df6d4e6220b1293aac12f5c8dc7dd034 100755
|
| --- a/tools/js2c.py
|
| +++ b/tools/js2c.py
|
| @@ -32,6 +32,7 @@
|
| # library.
|
|
|
| import os, re, sys, string
|
| +import jsmin
|
|
|
|
|
| def ToCArray(lines):
|
| @@ -44,7 +45,12 @@ def ToCArray(lines):
|
| return ", ".join(result)
|
|
|
|
|
| -def CompressScript(lines):
|
| +def CompressScript(lines, do_jsmin):
|
| + # If we're not expecting this code to be user visible, we can run it through
|
| + # a more aggressive minifier.
|
| + if do_jsmin:
|
| + return jsmin.jsmin(lines)
|
| +
|
| # Remove stuff from the source that we don't want to appear when
|
| # people print the source code using Function.prototype.toString().
|
| # Note that we could easily compress the scripts mode but don't
|
| @@ -272,9 +278,10 @@ def JS2C(source, target, env):
|
| for s in modules:
|
| delay = str(s).endswith('-delay.js')
|
| lines = ReadFile(str(s))
|
| + do_jsmin = lines.find('// jsminify this file, js2c: jsmin') != -1
|
| lines = ExpandConstants(lines, consts)
|
| lines = ExpandMacros(lines, macros)
|
| - lines = CompressScript(lines)
|
| + lines = CompressScript(lines, do_jsmin)
|
| data = ToCArray(lines)
|
| id = (os.path.split(str(s))[1])[:-3]
|
| if delay: id = id[:-6]
|
|
|