Fork me on GitHub

minify:minify

Full name:

com.7p-group:minify-maven-plugin:1.7.12-SNAPSHOT:minify

Description:

Goal for combining and minifying CSS and JavaScript files.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: process-resources.

Optional Parameters

Name Type Since Description
<bufferSize> int - Size of the buffer used to read source files.
Default: 4096
User Property: bufferSize
<bundleConfiguration> String 1.7.5 Specify aggregations in an external JSON formatted config file.
User Property: bundleConfiguration
<charset> String 1.3.2 If a supported character set is specified, it will be used to read the input file. Otherwise, it will assume that the platform's default character set is being used. The output file is encoded using the same character set.
See the IANA Charset Registry for a list of valid encoding types.
Default: ${project.build.sourceEncoding}
User Property: charset
<closureAngularPass> boolean 1.7.3 Generate $inject properties for AngularJS for functions annotated with @ngInject.
Default: false
User Property: closureAngularPass
<closureCompilationLevel> CompilationLevel 1.7.2 The degree of compression and optimization to apply to your JavaScript.
There are three possible compilation levels:
  • WHITESPACE_ONLY: Just removes whitespace and comments from your JavaScript.
  • SIMPLE_OPTIMIZATIONS: Performs compression and optimization that does not interfere with the interaction between the compiled JavaScript and other JavaScript. This level renames only local variables.
  • ADVANCED_OPTIMIZATIONS: Achieves the highest level of compression by renaming symbols in your JavaScript. When using ADVANCED_OPTIMIZATIONS compilation you must perform extra steps to preserve references to external symbols. See Advanced Compilation and Externs for more information about ADVANCED_OPTIMIZATIONS.

Default: SIMPLE_OPTIMIZATIONS
User Property: closureCompilationLevel
<closureCreateSourceMap> boolean 1.7.3 Collects information mapping the generated (compiled) source back to its original source for debugging purposes.
Please visit Source Map Revision 3 Proposal for more information.
Default: false
User Property: closureCreateSourceMap
<closureDefine> HashMap<String,String> 1.7.5 Override the value of variables annotated with @define.
The format is:

<define>
    <name>value</name>
</define>
where <name> is the name of a @define variable and value is a boolean, number or string.
User Property: closureDefine
<closureEnvironment> CompilerOptions$Environment 1.7.5 Determines the set of builtin externs to load.
Options: BROWSER, CUSTOM.
Default: BROWSER
User Property: closureEnvironment
<closureExterns> ArrayList<String> 1.7.2 List of JavaScript files containing code that declares function names or other symbols. Use closureExterns to preserve symbols that are defined outside of the code you are compiling. The closureExterns parameter only has an effect if you are using a CompilationLevel of ADVANCED_OPTIMIZATIONS.
These file names are relative to webappSourceDir directory.
User Property: closureExterns
<closureExtraAnnotations> ArrayList<String> 1.7.5 A whitelist of tag names in JSDoc. Needed to support JSDoc extensions like ngdoc.
User Property: closureExtraAnnotations
<closureLanguageIn> CompilerOptions$LanguageMode 1.7.2 Refers to which version of ECMAScript to assume when checking for errors in your code.
Possible values are:
  • ECMASCRIPT3: Checks code assuming ECMAScript 3 compliance, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5: Checks code assuming ECMAScript 5 compliance, allowing new features not present in ECMAScript 3, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5_STRICT: Like ECMASCRIPT5 but assumes compliance with strict mode ('use strict';).
  • ECMASCRIPT6: Checks code assuming ECMAScript 6 compliance, allowing new features not present in ECMAScript 5.
  • ECMASCRIPT6_STRICT: Like ECMASCRIPT6 but assumes compliance with strict mode ('use strict';).

Default: ECMASCRIPT_2016
User Property: closureLanguageIn
<closureLanguageOut> CompilerOptions$LanguageMode 1.7.5 Refers to which version of ECMAScript your code will be returned in.
It accepts the same options as closureLanguageIn and is used to transpile between different levels of ECMAScript.
Default: ECMASCRIPT5
User Property: closureLanguageOut
<closureSortDependencies> boolean 1.7.4 Enables or disables sorting mode for Closure Library dependencies.
If true, automatically sort dependencies so that a file that goog.provides symbol X will always come before a file that goog.requires symbol X.
Default: false
User Property: closureSortDependencies
<closureWarningLevels> HashMap<String,String> 1.7.5 Treat certain warnings as the specified CheckLevel:
  • ERROR: Makes all warnings of the given group to build-breaking error.
  • WARNING: Makes all warnings of the given group a non-breaking warning.
  • OFF: Silences all warnings of the given group.
Example:

<closureWarningLevels>
    <nonStandardJsDocs>OFF</nonStandardJsDocs>
</closureWarningLevels>
For the complete list of diagnostic groups please visit https://github.com/google/closure-compiler/wiki/Warnings.
User Property: closureWarningLevels
<cssEngine> MinifyMojo$Engine 1.7.1 Define the CSS compressor engine to use.
Possible values are:
Default: YUI
User Property: cssEngine
<cssFinalFile> String - CSS output file name.
Default: style.css
User Property: cssFinalFile
<cssSourceDir> String - CSS source directory.
Default: css
User Property: cssSourceDir
<cssSourceExcludes> ArrayList<String> 1.2 CSS files to exclude. Specified as fileset patterns which are relative to the CSS source directory.
User Property: cssSourceExcludes
Alias: cssExcludes
<cssSourceFiles> ArrayList<String> - CSS source file names list.
User Property: cssSourceFiles
Alias: cssFiles
<cssSourceIncludes> ArrayList<String> 1.2 CSS files to include. Specified as fileset patterns which are relative to the CSS source directory.
User Property: cssSourceIncludes
Alias: cssIncludes
<cssTargetDir> String 1.3.2 CSS target directory. Takes the same value as cssSourceDir when empty.
User Property: cssTargetDir
<jsEngine> MinifyMojo$Engine 1.6 Define the JavaScript compressor engine to use.
Possible values are:
Default: YUI
User Property: jsEngine
<jsFinalFile> String - JavaScript output file name.
Default: script.js
User Property: jsFinalFile
<jsSourceDir> String - JavaScript source directory.
Default: js
User Property: jsSourceDir
<jsSourceExcludes> ArrayList<String> 1.2 JavaScript files to exclude. Specified as fileset patterns which are relative to the JavaScript source directory.
User Property: jsSourceExcludes
Alias: jsExcludes
<jsSourceFiles> ArrayList<String> - JavaScript source file names list.
User Property: jsSourceFiles
Alias: jsFiles
<jsSourceIncludes> ArrayList<String> 1.2 JavaScript files to include. Specified as fileset patterns which are relative to the JavaScript source directory.
User Property: jsSourceIncludes
Alias: jsIncludes
<jsTargetDir> String 1.3.2 JavaScript target directory. Takes the same value as jsSourceDir when empty.
User Property: jsTargetDir
<nosuffix> boolean 1.7 Do not append a suffix to the minified output file name, independently of the value in the suffix parameter.
Warning: when both the options nosuffix and skipMerge are set to true, the plugin execution phase needs to be set to package, otherwise the output files will be overridden by the source files during the packaging.
Default: false
User Property: nosuffix
<skipMerge> boolean 1.5.2 Skip the merge step. Minification will be applied to each source file individually.
Default: false
User Property: skipMerge
<skipMinify> boolean 1.5.2 Skip the minify step. Useful when merging files that are already minified.
Default: false
User Property: skipMinify
<suffix> String 1.3.2 The output file name suffix.
Default: .min
User Property: suffix
<verbose> boolean - Display additional informational messages and warnings.
Default: false
User Property: verbose
<webappSourceDir> String - Webapp source directory.
Default: ${basedir}/src/main/webapp
User Property: webappSourceDir
<webappTargetDir> String - Webapp target directory.
Default: ${project.build.directory}/${project.build.finalName}
User Property: webappTargetDir
<yuiDisableOptimizations> boolean - Disable all the built-in micro-optimizations.
Default: false
User Property: yuiDisableOptimizations
<yuiLineBreak> int - Some source control tools don't like files containing lines longer than, say 8000 characters. The line-break option is used in that case to split long lines after a specific column. It can also be used to make the code more readable and easier to debug. Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS. Specify -1 to disallow line breaks.
Default: -1
User Property: yuiLineBreak
<yuiNoMunge> boolean - Minify only. Do not obfuscate local symbols.
Default: false
User Property: yuiNoMunge
<yuiPreserveSemicolons> boolean - Preserve unnecessary semicolons (such as right before a '}'). This option is useful when compressed code has to be run through JSLint.
Default: false
User Property: yuiPreserveSemicolons

Parameter Details

<bufferSize>

Size of the buffer used to read source files.
  • Type: int
  • Required: No
  • User Property: bufferSize
  • Default: 4096

<bundleConfiguration>

Specify aggregations in an external JSON formatted config file.
  • Type: java.lang.String
  • Since: 1.7.5
  • Required: No
  • User Property: bundleConfiguration

<charset>

If a supported character set is specified, it will be used to read the input file. Otherwise, it will assume that the platform's default character set is being used. The output file is encoded using the same character set.
See the IANA Charset Registry for a list of valid encoding types.
  • Type: java.lang.String
  • Since: 1.3.2
  • Required: No
  • User Property: charset
  • Default: ${project.build.sourceEncoding}

<closureAngularPass>

Generate $inject properties for AngularJS for functions annotated with @ngInject.
  • Type: boolean
  • Since: 1.7.3
  • Required: No
  • User Property: closureAngularPass
  • Default: false

<closureCompilationLevel>

The degree of compression and optimization to apply to your JavaScript.
There are three possible compilation levels:
  • WHITESPACE_ONLY: Just removes whitespace and comments from your JavaScript.
  • SIMPLE_OPTIMIZATIONS: Performs compression and optimization that does not interfere with the interaction between the compiled JavaScript and other JavaScript. This level renames only local variables.
  • ADVANCED_OPTIMIZATIONS: Achieves the highest level of compression by renaming symbols in your JavaScript. When using ADVANCED_OPTIMIZATIONS compilation you must perform extra steps to preserve references to external symbols. See Advanced Compilation and Externs for more information about ADVANCED_OPTIMIZATIONS.
  • Type: com.google.javascript.jscomp.CompilationLevel
  • Since: 1.7.2
  • Required: No
  • User Property: closureCompilationLevel
  • Default: SIMPLE_OPTIMIZATIONS

<closureCreateSourceMap>

Collects information mapping the generated (compiled) source back to its original source for debugging purposes.
Please visit Source Map Revision 3 Proposal for more information.
  • Type: boolean
  • Since: 1.7.3
  • Required: No
  • User Property: closureCreateSourceMap
  • Default: false

<closureDefine>

Override the value of variables annotated with @define.
The format is:

<define>
    <name>value</name>
</define>
where <name> is the name of a @define variable and value is a boolean, number or string.
  • Type: java.util.HashMap<java.lang.String, java.lang.String>
  • Since: 1.7.5
  • Required: No
  • User Property: closureDefine

<closureEnvironment>

Determines the set of builtin externs to load.
Options: BROWSER, CUSTOM.
  • Type: com.google.javascript.jscomp.CompilerOptions$Environment
  • Since: 1.7.5
  • Required: No
  • User Property: closureEnvironment
  • Default: BROWSER

<closureExterns>

List of JavaScript files containing code that declares function names or other symbols. Use closureExterns to preserve symbols that are defined outside of the code you are compiling. The closureExterns parameter only has an effect if you are using a CompilationLevel of ADVANCED_OPTIMIZATIONS.
These file names are relative to webappSourceDir directory.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.7.2
  • Required: No
  • User Property: closureExterns

<closureExtraAnnotations>

A whitelist of tag names in JSDoc. Needed to support JSDoc extensions like ngdoc.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.7.5
  • Required: No
  • User Property: closureExtraAnnotations

<closureLanguageIn>

Refers to which version of ECMAScript to assume when checking for errors in your code.
Possible values are:
  • ECMASCRIPT3: Checks code assuming ECMAScript 3 compliance, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5: Checks code assuming ECMAScript 5 compliance, allowing new features not present in ECMAScript 3, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5_STRICT: Like ECMASCRIPT5 but assumes compliance with strict mode ('use strict';).
  • ECMASCRIPT6: Checks code assuming ECMAScript 6 compliance, allowing new features not present in ECMAScript 5.
  • ECMASCRIPT6_STRICT: Like ECMASCRIPT6 but assumes compliance with strict mode ('use strict';).
  • Type: com.google.javascript.jscomp.CompilerOptions$LanguageMode
  • Since: 1.7.2
  • Required: No
  • User Property: closureLanguageIn
  • Default: ECMASCRIPT_2016

<closureLanguageOut>

Refers to which version of ECMAScript your code will be returned in.
It accepts the same options as closureLanguageIn and is used to transpile between different levels of ECMAScript.
  • Type: com.google.javascript.jscomp.CompilerOptions$LanguageMode
  • Since: 1.7.5
  • Required: No
  • User Property: closureLanguageOut
  • Default: ECMASCRIPT5

<closureSortDependencies>

Enables or disables sorting mode for Closure Library dependencies.
If true, automatically sort dependencies so that a file that goog.provides symbol X will always come before a file that goog.requires symbol X.
  • Type: boolean
  • Since: 1.7.4
  • Required: No
  • User Property: closureSortDependencies
  • Default: false

<closureWarningLevels>

Treat certain warnings as the specified CheckLevel:
  • ERROR: Makes all warnings of the given group to build-breaking error.
  • WARNING: Makes all warnings of the given group a non-breaking warning.
  • OFF: Silences all warnings of the given group.
Example:

<closureWarningLevels>
    <nonStandardJsDocs>OFF</nonStandardJsDocs>
</closureWarningLevels>
For the complete list of diagnostic groups please visit https://github.com/google/closure-compiler/wiki/Warnings.
  • Type: java.util.HashMap<java.lang.String, java.lang.String>
  • Since: 1.7.5
  • Required: No
  • User Property: closureWarningLevels

<cssEngine>

Define the CSS compressor engine to use.
Possible values are:
  • Type: com.sevenprinciplesmobility.maven.minify.plugin.MinifyMojo$Engine
  • Since: 1.7.1
  • Required: No
  • User Property: cssEngine
  • Default: YUI

<cssFinalFile>

CSS output file name.
  • Type: java.lang.String
  • Required: No
  • User Property: cssFinalFile
  • Default: style.css

<cssSourceDir>

CSS source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: cssSourceDir
  • Default: css

<cssSourceExcludes>

CSS files to exclude. Specified as fileset patterns which are relative to the CSS source directory.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.2
  • Required: No
  • User Property: cssSourceExcludes
  • Alias: cssExcludes

<cssSourceFiles>

CSS source file names list.
  • Type: java.util.ArrayList<java.lang.String>
  • Required: No
  • User Property: cssSourceFiles
  • Alias: cssFiles

<cssSourceIncludes>

CSS files to include. Specified as fileset patterns which are relative to the CSS source directory.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.2
  • Required: No
  • User Property: cssSourceIncludes
  • Alias: cssIncludes

<cssTargetDir>

CSS target directory. Takes the same value as cssSourceDir when empty.
  • Type: java.lang.String
  • Since: 1.3.2
  • Required: No
  • User Property: cssTargetDir

<jsEngine>

Define the JavaScript compressor engine to use.
Possible values are:
  • Type: com.sevenprinciplesmobility.maven.minify.plugin.MinifyMojo$Engine
  • Since: 1.6
  • Required: No
  • User Property: jsEngine
  • Default: YUI

<jsFinalFile>

JavaScript output file name.
  • Type: java.lang.String
  • Required: No
  • User Property: jsFinalFile
  • Default: script.js

<jsSourceDir>

JavaScript source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: jsSourceDir
  • Default: js

<jsSourceExcludes>

JavaScript files to exclude. Specified as fileset patterns which are relative to the JavaScript source directory.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.2
  • Required: No
  • User Property: jsSourceExcludes
  • Alias: jsExcludes

<jsSourceFiles>

JavaScript source file names list.
  • Type: java.util.ArrayList<java.lang.String>
  • Required: No
  • User Property: jsSourceFiles
  • Alias: jsFiles

<jsSourceIncludes>

JavaScript files to include. Specified as fileset patterns which are relative to the JavaScript source directory.
  • Type: java.util.ArrayList<java.lang.String>
  • Since: 1.2
  • Required: No
  • User Property: jsSourceIncludes
  • Alias: jsIncludes

<jsTargetDir>

JavaScript target directory. Takes the same value as jsSourceDir when empty.
  • Type: java.lang.String
  • Since: 1.3.2
  • Required: No
  • User Property: jsTargetDir

<nosuffix>

Do not append a suffix to the minified output file name, independently of the value in the suffix parameter.
Warning: when both the options nosuffix and skipMerge are set to true, the plugin execution phase needs to be set to package, otherwise the output files will be overridden by the source files during the packaging.
  • Type: boolean
  • Since: 1.7
  • Required: No
  • User Property: nosuffix
  • Default: false

<skipMerge>

Skip the merge step. Minification will be applied to each source file individually.
  • Type: boolean
  • Since: 1.5.2
  • Required: No
  • User Property: skipMerge
  • Default: false

<skipMinify>

Skip the minify step. Useful when merging files that are already minified.
  • Type: boolean
  • Since: 1.5.2
  • Required: No
  • User Property: skipMinify
  • Default: false

<suffix>

The output file name suffix.
  • Type: java.lang.String
  • Since: 1.3.2
  • Required: No
  • User Property: suffix
  • Default: .min

<verbose>

Display additional informational messages and warnings.
  • Type: boolean
  • Required: No
  • User Property: verbose
  • Default: false

<webappSourceDir>

Webapp source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: webappSourceDir
  • Default: ${basedir}/src/main/webapp

<webappTargetDir>

Webapp target directory.
  • Type: java.lang.String
  • Required: No
  • User Property: webappTargetDir
  • Default: ${project.build.directory}/${project.build.finalName}

<yuiDisableOptimizations>

Disable all the built-in micro-optimizations.
  • Type: boolean
  • Required: No
  • User Property: yuiDisableOptimizations
  • Default: false

<yuiLineBreak>

Some source control tools don't like files containing lines longer than, say 8000 characters. The line-break option is used in that case to split long lines after a specific column. It can also be used to make the code more readable and easier to debug. Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS. Specify -1 to disallow line breaks.
  • Type: int
  • Required: No
  • User Property: yuiLineBreak
  • Default: -1

<yuiNoMunge>

Minify only. Do not obfuscate local symbols.
  • Type: boolean
  • Required: No
  • User Property: yuiNoMunge
  • Default: false

<yuiPreserveSemicolons>

Preserve unnecessary semicolons (such as right before a '}'). This option is useful when compressed code has to be run through JSLint.
  • Type: boolean
  • Required: No
  • User Property: yuiPreserveSemicolons
  • Default: false