Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

CSS Minification not working

Avatar

Level 2

Hi, 

I am trying to minify CSS in aem 6.5 by using 

cssProcessor="[min:yui]"

in context.xml files. Is it the correct way? Because by using 

jsProcessor="[min:gcc;languageIn=ECMASCRIPT_2015]"

I am able to minify js but css filenames contains .min but they are actually minified. Also,  in http://localhost:4502/system/console/configMgr/com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManag... url I have checked Minify checkbox. What to do for enabling and getting minified css?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Please take a into AEM error.log file and search for that css filename, there you will be seeing some error. 

Please share that error with Front End team to fix this issue [I did the same in my last project].

 

Parallelly you could prepare below information at your end -

AEM 6.5 uses following yuicompressor-2.4.8-granite-003 for css minification also highlighted in below screenshot -

DEBAL_DAS_1-1656412102486.png

You will be getting that jar from below location [Bundle ID may vary in your case] -

DEBAL_DAS_3-1656413146146.png

 

 

Please run following command : 

java -jar yuicompressor-2.4.8-granite-003.jar <actual css file> -o outfulfile(minified file)

After executing this command , you might see some error during minification via yui compressor. 

Please share the same with Front End team also.

 

Personally I have seen in my project Front End developers do the minification outside as part of the Frontend build process, Front End developers would not rely on the AEM features, because there are better ways and tools to do so.

 

 

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Please take a into AEM error.log file and search for that css filename, there you will be seeing some error. 

Please share that error with Front End team to fix this issue [I did the same in my last project].

 

Parallelly you could prepare below information at your end -

AEM 6.5 uses following yuicompressor-2.4.8-granite-003 for css minification also highlighted in below screenshot -

DEBAL_DAS_1-1656412102486.png

You will be getting that jar from below location [Bundle ID may vary in your case] -

DEBAL_DAS_3-1656413146146.png

 

 

Please run following command : 

java -jar yuicompressor-2.4.8-granite-003.jar <actual css file> -o outfulfile(minified file)

After executing this command , you might see some error during minification via yui compressor. 

Please share the same with Front End team also.

 

Personally I have seen in my project Front End developers do the minification outside as part of the Frontend build process, Front End developers would not rely on the AEM features, because there are better ways and tools to do so.

 

 

 

 

Avatar

Level 2

After writing the command I am getting Error: Could not find or load main class jar.

Avatar

Employee Advisor

1. Identify the bundle id associated with yuicompressor-2.4.8-granite-003 via /system/console/bundles

2. Next we need to download the bundle:yuicompressor-2.4.8-granite-003 from AEM-instances\demo-author\crx-quickstart\launchpad\felix\bundle288\version0.1\bundle.jar-embedded [Bundle ID may vary in your case]

3.Please copy that bundle and please keep/paste it inside a separate folder.

4. Then open cmd from that folder and run that command.