Enable Minify only for few ClientLibs

Avatar

Avatar

sunily21159739

Avatar

sunily21159739

sunily21159739

08-01-2020

Hi All,

I am working in AEM6.4.2. There two applications are running on same AEM instances and one of the application is not using minification of Js/Css thats why they have disabled "minify" option on configuration level.

I am using minification version of our css and  when I am deploying my application on same instance, I am getting css issue because "minify" option is disabled. If I will enable it then everything's are working fine but first application start breaking.

Please let me know how can I enable "minify" only for my ClientLibs.

I know, we can disabled "minify" for particular ClientLibs by :

jsProcessor String[] default:none, min:none

cssProcessor String[] default:none, min:none

 

I am looking for vice versa,wants to enable minify for particular ClientLibs. Please suggest.

 

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

gargsahil099

Avatar

gargsahil099

gargsahil099

10-01-2020

Hi Sunil,

 

You can try to use the below properties on node as they always have more precedence then OSGI configuration. Just disable the OSGI minification configuration and add the below properties on client lib node

cssProcessor: ["default:none", "min:yui"]
jsProcessor: ["default:none", "min:gcc;compilationLevel=advanced"]

 

Regards

Sahil garg.

Answers (1)

Answers (1)

Avatar

Avatar

jbrar

Employee

Avatar

jbrar

Employee

jbrar
Employee

09-01-2020

You can choose to configure the preprocessors configuration per clientlibrary or system-wide.

  • Add the multivalue properties cssProcessor and jsProcessor on the clientlibrary node
  • Or define the system default configuration via the HTML Library Manager OSGi configuration

A preprocessor configuration on the clientlib node takes precedence over the OSGI configuration.

Format and Examples
FORMAT
 
config:= mode ":" processorName options*;
mode:= "default" | "min";
processorName := "none" | <name>;
options := ";" option;
option := name "=" value;
YUI COMPRESSOR FOR CSS MINIFICATION AND GCC FOR JS
 
cssProcessor: ["default:none", "min:yui"]
jsProcessor: ["default:none", "min:gcc;compilationLevel=advanced"]
TYPESCRIPT TO PREPROCESS AND THEN GCC TO MINIFY AND OBFUSCATE
 
jsProcessor: [
   "default:typescript",
   "min:typescript",
   "min:gcc;obfuscate=true"
]
ADDITIONAL GCC OPTIONS
 
failOnWarning (defaults to "false")
languageIn (defaults to "ECMASCRIPT5")
languageOut (defaults to "ECMASCRIPT5")
compilationLevel (defaults to "simple") (can be "whitespace", "simple", "advanced")