標籤:des style blog http io color ar os sp
1 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 2 <modelVersion>4.0.0</modelVersion> 3 <!-- 項目所在組、機構 --> 4 <groupId>com.test</groupId> 5 <!-- 項目產品名稱 --> 6 <artifactId>test-mobile</artifactId> 7 <!-- 項目產品版本 --> 8 <version>1.0.0</version> 9 <!-- pom屬性配置 -->10 <properties>11 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>12 </properties>13 <!-- 構建相關配置 -->14 <build>15 <!-- maven外掛程式配置 -->16 <plugins>17 <plugin>18 <!-- YUI Compressor Maven壓縮外掛程式 -->19 <groupId>net.alchim31.maven</groupId>20 <artifactId>yuicompressor-maven-plugin</artifactId>21 <version>1.3.0</version> 22 <configuration>23 <!-- 讀取js,css檔案採用UTF-8編碼 -->24 <encoding>UTF-8</encoding>25 <!-- 不顯示js可能的錯誤 -->26 <jswarn>false</jswarn>27 <!-- 若存在已壓縮的檔案,會先對比源檔案是否有改動28 有改動便壓縮,無改動就不壓縮 -->29 <force>false</force>30 <!-- 在指定的列號後插入新行 -->31 <linebreakpos>-1</linebreakpos>32 <!-- 壓縮之前先執行彙總檔案操作 -->33 <preProcessAggregates>true</preProcessAggregates>34 <!-- 壓縮後儲存檔案尾碼 -->35 <suffix>.min</suffix>36 <!-- 來源目錄,即需壓縮的根目錄 -->37 <sourceDirectory>${basedir}/mobile</sourceDirectory>38 <!-- 壓縮js和css檔案 -->39 <includes>40 <include>**/*.js</include>41 <include>**/*.css</include>42 </includes>43 <!-- 以下目錄和檔案不會被壓縮 -->44 <excludes>45 <exclude>**/*.min.js</exclude>46 <exclude>**/*.min.css</exclude>47 <exclude>scripts/data/*.js</exclude>48 </excludes>49 <!-- 壓縮後輸出檔案目錄 -->50 <outputDirectory>${basedir}/mobile</outputDirectory>51 <!-- 彙總檔案 -->52 <aggregations>53 <aggregation>54 <!-- 合并每一個檔案後插入一新行 -->55 <insertNewLine>true</insertNewLine>56 <!-- 需合并檔案的根資料夾 -->57 <inputDir>${basedir}/mobile/scripts</inputDir>58 <!-- 最終合并的輸出檔案 -->59 <output>${basedir}/mobile/scripts/app/app.js</output>60 <!-- 把以下js檔案合并成一個js檔案,是按順序合并的 -->61 <includes>62 <include>app/core.js</include>63 <include>app/mlmanager.js</include>64 <include>app/tmpl.js</include>65 <include>app/ui.js</include>66 </includes>67 </aggregation>68 </aggregations>69 </configuration>70 </plugin>71 </plugins>72 </build>73 </project>View Code
原文地址:http://wang-jia-sina-com.iteye.com/blog/1538000
maven 配置合并壓縮JS+CSS