我有一个 Maven 配置文件,我想为它缩小我所有的 javascript 和 css 文件。对于开发,我有compressed.js
和compressed.css
文件,它们只是注入其他脚本/样式表。我想要的是用实际压缩的文件覆盖这些文件,但只有 .js 缩小对我有用。
这是我个人资料的一部分:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<linebreakpos>999999</linebreakpos>
<jswarn>false</jswarn>
<excludes>
<exclude>**/compressed.js</exclude>
</excludes>
<aggregations>
<aggregation>
<removeIncluded>true</removeIncluded>
<insertNewLine>false</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/compressed.js
</output>
<includes>
<include>**/components/sample-min.js</include>
<include>**/components/sample2-min.js</include>
</includes>
<excludes>
<exclude>**/compressed.js</exclude>
</excludes>
</aggregation>
</aggregations>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<excludes>js/**</excludes>
</configuration>
</plugin>
当我修改以下几行时,它在已经compressed.css
存在时根本不起作用,当不存在时,它会缩小。
添加到yuicompressor-maven-plugin
:
<exclude>**/compressed.css</exclude>
...
<aggregations>
<aggregation>
<removeIncluded>true</removeIncluded>
<insertNewLine>false</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/css/compressed.css
</output>
<includes>
<include>**/sample-min.css</include>
<include>**/sample2-min.css</include>
</includes>
<excludes>
<exclude>**/compressed.css</exclude>
</excludes>
</aggregation>
变化maven-war-plugin
:
<excludes>
<exclude>js/**</exclude>
<exclude>css/**</exclude>
</excludes>
请问,我做错了什么?