【问题标题】:Compressing everything not just the source directory with Maven使用 Maven 压缩所有内容,而不仅仅是源目录
【发布时间】:2013-12-09 11:44:41
【问题描述】:

我正在使用 maven 使用 YUI 压缩器来压缩我的 javascript 文件。 我有聚合工作,只结合想要的东西。但是我需要 YUI 来压缩我的网络应用程序文件夹中的一个文件夹。我已经指定了源文件夹,但这似乎被忽略了。相反, src/main/webapps 中的每个 .js 文件似乎都被压缩了。我需要保持现有文件完好无损,只压缩目录中的文件。 这是我的代码:

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>yuicompressor-maven-plugin</artifactId>
  <version>1.3.2</version>
  <configuration>
      <preProcessAggregates>true</preProcessAggregates>
      <aggregations>
          <aggregation>
              <insertNewLine>true</insertNewLine>
              <output>${project.basedir}/target/umadesktop/angular/app/single.js</output>
              <inputDir>${project.basedir}/src/main/webapp/angular/app</inputDir>
              <includes>
                  <include>**/*.js</include>
              </includes>
              <excludes>
                  <exclude>**/*abc.js</exclude>
                  <exclude>**/compressed.css</exclude>
              </excludes>
          </aggregation>
      </aggregations>
      <excludes>
          <exclude>**/scripts/**/*.js</exclude>
      </excludes>
      <jswarn>false</jswarn>
      <nosuffix>false</nosuffix>
      <sourceDirectory>${project.basedir}/src/main/webapp/angular/app</sourceDirectory>
      <outputDirectory>${project.basedir}/target/umadesktop/angular/app/</outputDirectory>
  </configuration>
  <executions>
      <execution>
          <id>compress_js_css</id>
          <phase>process-resources</phase>
          <goals>
              <goal>compress</goal>
          </goals>
      </execution>
  </executions>
</plugin>

【问题讨论】:

    标签: javascript maven yui minify yui-compressor


    【解决方案1】:

    你应该看看Minify Maven Plugin,这听起来就像你需要的东西。
    如果您在配置方面需要任何帮助,请告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-20
      • 1970-01-01
      相关资源
      最近更新 更多