简体   繁体   English

YUI源目录过滤器

[英]YUI source directory filter

I am using YUI maven plugin and I want to know how to compress a specific directory and exclude all others. 我正在使用YUI maven插件,我想知道如何压缩特定目录并排除所有其他目录。

In maven I declare src/main/webapp/javascript to get all .js files in this directory but in the output directory all js of application in this directory appear. 在maven中,我声明src / main / webapp / javascript以获取此目录中的所有.js文件,但是在输出目录中,此目录中所有应用程序的js都会出现。

Thanks. 谢谢。

Check out the usage page . 查看使用情况页面 It contains instructions on how to accomplish such tasks. 它包含有关如何完成此类任务的说明。

Here's your scenario: 这是您的情况:

<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>

There is no includes parameter, so you can't specify only one directory and have all others excluded. 没有includes参数,因此您不能仅指定一个目录,而将所有其他目录排除在外。 However, you can achieve the same functionality by combining the outputDirectory and sourceDirectory parameters. 但是,通过组合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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM