YUI源目录过滤器

0 javascript compression yui maven-2 maven

我正在使用YUI maven插件,我想知道如何压缩特定目录并排除所有其他目录.

在maven中,我声明src/main/webapp/javascript来获取此目录中的所有.js文件,但是在输出目录中显示此目录中的所有应用程序js.

谢谢.

Sea*_*oyd 6

查看使用情况页面.它包含有关如何完成此类任务的说明.

这是你的情景:

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>yuicompressor-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>compress</goal>
      </goals>
    </execution>
  </executions>        
  <configuration>
    <excludes>
      <!-- add excludes here -->
      <exclude>**/*.pack.js</exclude>
      <exclude>**/compressed.css</exclude>
    </excludes>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

没有includes参数,因此您不能仅指定一个目录并排除所有其他目录.但是,您可以通过组合outputDirectorysourceDirectory参数来实现相同的功能.

<configuration>
    <!-- select only the directory you want to compress -->
    <sourceDirectory>${project.basedir}/src/main/javascript/yourSubDir
    </sourceDirectory>
    <!-- and send it to the right output directory -->
    <outputDirectory>${project.build.outputDirectory}/yourSubDir
    </outputDirectory>
</configuration>
Run Code Online (Sandbox Code Playgroud)