Compiling and minifyingJavaScript files in the system management admin

About this task

For compiling and minifying JavaScript Files in the System Administration console, you need to perform the following sequence of actions;

Procedure

  1. Run the jscompile command to get possible JavaScript compilation warnings using the sci_ant.sh command from the <Install>/bin directory. This command works with the jsUtil.xml file in the same directory. This command can include the following properties:
    Note: This is an optional step and not a requirement for minification.
    • gis.install: Installation directory path.
    • srcDir: Source directory.
    • errorOnly: Indicates whether to check for all warnings and errors (false) or for errors only (true). Defaults to false.
    • format: Output format - (h) for html/(t) for text. Defaults to t. If errorOnly is set to true, only html (h) is the valid option.
    • outputFile: Output file path. If file path is not provided or file doesn't exist. all warnings will be directed to standard output.
    • warningOptions: Warning options (comma separated). Default options: [onevar, undef, forin, debug, browser, eqeqeq, newcap, evil]. For all warning options, see the JSLint website.

      For example;

      ./sci_ant.sh -f jsUtil.xml jscompile -Dgis.install=<Install Dir> -DsrcDir=
      <Install Dir>/repository/eardata/sma/war/sma
      Note: If you are using sci_ant.sh, then gis.install becomes optional.
  2. Combine your files into one file by minifying the files using the sci_ant.sh command from the <Install>/bin directory. This command works with the jsUtil.xml file in the same directory. This command can include the following properties:
    • gis.install: Installation directory path.
    • jsbDir: JSB directory path (mandatory).
    • minify: Indicates whether files should be minified (true/false). Defaults to true (minify files). Optional.
    • srcDir: Source directory. Will be used if input attribute is not specified in JSB. Optional.
    • destDir: Destination directory. Will be used if input attribute is not specified in JSB. Optional.
    • createIndividualFile: Indicates whether to create individual files (true/false). Defaults to false (do not create individual files). Optional.
    • jscompile: Indicates whether to get JavaScript warning/errors (true/false). Defaults to true (get errors).

      For example;

      ./sci_ant.sh -f jsUtil.xml minify-js -Dgis.install=<Install Dir>
      -DsrcDir=<Install Dir>/repository/eardata/sma/war
      -DjsbDir=<Install Dir>/repository/eardata/sma/war/builder
      -DdestDir=<Install Dir>/repository/eardata/sma/war
      Note: If you are using sci_ant.sh, then gis.install becomes optional.