Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

YUI Compressor and SAMAXES plugin trimming the spaces while css minification

Avatar

Avatar
Ignite 1
Level 1
gajanank2729265
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
View profile

Avatar
Ignite 1
Level 1
gajanank2729265
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
View profile
gajanank2729265
Level 1

01-03-2019

Hi All,

I am trying to use SAMAXES and YUI maven plugin to minify the css during the maven build. but both of these plugins are trimming the spaces in the css as

calc (14px + (some function) getting replaced with (14px+(some function))

which makes the value invalid in the browser.

In case anyone faced the similar issue can you please let me know ?

i am doing the following configuration in my pom.xml

For YUI following is teh configuration used

<!-- minify css through maven start -->
<plugin>

   <artifactId>yuicompressor-maven-plugin</artifactId>

   <groupId>net.alchim31.maven</groupId>

   <version>1.5.1</version>

   <executions>

   <execution>

   <goals>

   <goal>compress</goal>

   </goals>

   </execution>

   </executions>

   <configuration>

   <webappDirectory>project dir</webappDirectory>

   <excludes>

   <exclude>**/*.js</exclude>

   <exclude>**/*.min.css</exclude>

   </excludes>

   <includes>

   <include>**/*.css</include>

   </includes>

   <force>true</force>

   </configuration>

</plugin>

<!-- minify css through maven end -->

For SAMAXES,

<plugin>

     <groupId>com.samaxes.maven</groupId>

     <artifactId>minify-maven-plugin</artifactId>

     <version>1.7.6</version>

          <executions>

               <execution>

                    <id>default-minify</id>

                         <configuration>

                              <webappSourceDir>source dir</webappSourceDir>

                              <cssSourceDir>css</cssSourceDir>

                              <webappTargetDir>target dir</webappTargetDir>

                              <cssTargetDir>css</cssTargetDir>

                              <cssSourceFiles>

                              <cssSourceFile>style.css</cssSourceFile>

                              </cssSourceFiles>

                              <cssFinalFile>project.css</cssFinalFile>

                         </configuration>

                         <goals>

                              <goal>minify</goal>

                         </goals>

               </execution>

          </executions>

</plugin>

Thanks..

Replies

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

01-03-2019

check this for a workaround - https://github.com/yui/yuicompressor/issues/59

or use an alternative to calc()

otherwise try with npm based minifiers..

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

15-03-2019

Hi Gajan

   AEM has inbuilt minification in its publish env unless you have disabled it in Publish. The JS and CSS will be minified using YUI engine by default. But due to the incompatibility of the YUI engine to minify the latest UI technologies , it is recommended to use the latest minification engine GCC . Please see here Change the minification engine for client libraries in AEM

Thanks

Veena