Skip to content

JavaScript Minifier settings

Ben McIntyre edited this page Jul 12, 2018 · 2 revisions

The following are the options for minify within bundleconfig.json when minifying JavaScript files:

JavaScript Minifier settings

enabled

Type: bool Default: true

Enable/disable minification. This is a global minification setting and applies to all files types (JS, CSS, HTML etc).

Example

[
    {
        "minify": {
            enabled: true
        }
    }
]

alwaysEscapeNonAscii

Type: bool Default: true

true escapes no ASCII characters

Example

[
    {
        "minify": {
            alwaysEscapeNonAscii: true
        }
    }
]

preserveImportantComments

Type: bool Default: true

true preserves important comments, that is either loud comments /*! */ or preserve/license comments: /** @preserve */ /**@license */

Example

[
    {
        "minify": {
            preserveImportantComments: true
        }
    }
]

termSemicolons

Type: bool Default: true

Forces all rules to be terminated with semicolons if set to true

Example

[
    {
        "minify": {
            termSemicolons: true
        }
    }
]

renameLocals

Type: bool Default: true

true renames local variables

Example

[
    {
        "minify": {
            renameLocals: true
        }
    }
]

evalTreatment

Type: String Default: ignore Values: ignore, makeImmediateSafe, makeAllSafe

How to treat renaming of variables inside eval statements. ignore does just that - doesn't rename any variables. makeImmediateSafe ensures no variables in the immediate scope of the eval statement will be renamed. makeAllSafe ensures no variables in the scope of the eval statement, nor in any parent scopes, will be renamed.

Example

[
    {
        "minify": {
            evalTreatment: "ignore"
        }
    }
]

outputMode

Type: String Default: singleLine Values: singleLine, multipleLines, none

singleLine removes new lines and outputs on a single line whilst multipleLines indents lines with the number of characters specified by indentSize

Example

[
    {
        "minify": {
            outputMode: "singleLine"
        }
    }
]

indentSize

Type: Number Default: 2 Special: Only applies if outputMode: "multipleLines"

The size of identation (number of spaces) at the start of lines, if outputMode: "multipleLines"

Example

[
    {
        "minify": {
            indentSize: 4
        }
    }
]