Maven YUI Compressor, concat, but not decreasing (turns off compression)

I am working on an old project, this is a Vaadin component that uses the Maven YUI plugin to minify and concatenate javascript files. 40 js files.

The YUI plugin works as it should, minifying 40 js files and merging them into one file (which is then referenced @javascript

in Vaadin).

Due to the development of thumbnails for new features is painful, but I cannot remove the YUI plugin because then I will need to add annotation @javascript

for all 40 js files.

Is there any way to make YUI aggregate but not . I read the docs and tried to change the targets (i.e. jslint only), but it seems like I can't merge if I don't use the target compress

.

Did I miss something?

Here's my YUI config as such:

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>yuicompressor-maven-plugin</artifactId>
  <version>1.5.1</version>
  <executions>
    <execution>
      <id>jslint</id>
      <goals>
        <goal>jslint</goal>
      </goals>
      <configuration>
      <includes>
        <include>**/*.js</include>
      </includes>
      <excludes>
        <exclude>**/VAADIN/js/*.js</exclude>
        <exclude>**/depends/*.js</exclude>
      </excludes>
      </configuration>
    </execution>
  <execution>
  <id>minify</id>
  <goals>
    <goal>compress</goal>
  </goals>
  <configuration>
  <nosuffix>true</nosuffix>
  <force>true</force>       
  <excludeWarSourceDirectory>true</excludeWarSourceDirectory>
  <linebreakpos>-1</linebreakpos>
  <aggregations>
    <aggregation>
      <inputDir>target/classes/[path]/components</inputDir>
      <removeIncluded>true</removeIncluded>
      <output>${project.build.directory}/classes/[path].js</output>
    <includes>
      <include>**/*.js</include>
      <include>**/Copyright.txt</include>
    </includes>
    <excludes>
      <exclude>**/depends/d3_3.4.6.js</exclude>
    </excludes>
    </aggregation>
  </aggregations>
  <includes>
    <include>**/*.js</include>
    <include>**/[project.name].css</include>
  </includes>
  <excludes>
    <exclude>**/depends/*.js</exclude>
  </excludes>
  </configuration>
  </execution>
  </executions>
</plugin>

      

Nb I also tried above with aggregation config in jslint target with no joy.

There has to be a way to stop the compression (I know YUI is a compression plugin, but it has other features (like lint), so I assume you can turn compression off). Also, the Vaadin annotation @javascript

accepts a comma separated list of js files. I feel like adding 40 would be too big, but maybe there is a way @javascript

to take the directory. (the docs don't mention this though)

+3


source to share


1 answer


Having decided to answer this question, I found a solution, a party for those who found it, and in part because it didn't get any other answers.

The solution was inspired by this answer when someone asked what I needed. @Mady pointed out that different include / exclude in plugin config



The story is long, you can exclude ALL .js files in minifyer , but included them in the convention:

<execution>
  <id>minify</id>
  <goals>
    <goal>compress</goal>
  </goals>                      
  <configuration>
    <nosuffix>true</nosuffix>
    <force>true</force>
    <excludeWarSourceDirectory>true</excludeWarSourceDirectory>
    <linebreakpos>-1</linebreakpos>
    <aggregations>
      <aggregation>
        <includes>
          <include>**/*.js</include> <!-- INCLUDES FOR CONCATENATION -->
        </includes>
      </aggregation>
    </aggregations>
    <excludes>
      <exclude>**/*.js</exclude> <!-- EXCLUDE ALL JS FROM MINIFICATION -->
    </excludes> 
  </configuration>
</execution>

      

+5


source







All Articles