最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用YUI+Ant 實現(xiàn)JS CSS壓縮

 更新時間:2014年09月02日 17:46:35   投稿:hebedich  
YUI庫是一組工具和控件,它們用JavaScript寫成, 為的是用DOM 腳本,DHTML和AJAX等技術(shù)創(chuàng)建豐富的網(wǎng)頁交互式應(yīng)用程序。YUI 基于BSD協(xié)議,對所有的使用方式都是免費的。YUI 項目包括YUI 庫和兩個創(chuàng)建時工具:YUI Compressor (壓縮)和YUI Doc(JavaScripts代碼的文檔引擎)

今天研究了一下YUI yahoo開源框架,感覺很猛啊。

于是乎我做了一個YUI的ant實現(xiàn),網(wǎng)上好多關(guān)于bat的實現(xiàn),我就另辟蹊徑,出個關(guān)于這個的ant實現(xiàn),嘿嘿獨一無二的文章,如果轉(zhuǎn)載的話,其注明作者和網(wǎng)站

copyright:Mr.chen

好了具體操作如下:

官網(wǎng):

yuicompressor-2.4.6.jar 下載地址 http://yuilibrary.com/downloads/#yuicompressor

YUIAnt.jar 下載地址 http://www.ubik-ingenierie.com/miscellanous/YUIAnt/

具體的相關(guān)代碼如下:

#css work dir 
commonCss.dir = css 
 
#js work dir 
commonJs.dir = js 
 
#build temp dir  
output.temp.dir = build 
 
#output files in the directory 
output.dir = ${output.temp.dir}_output 
 
#environment needs lib 
liblib = lib 
 
<?xml version="1.0" encoding="UTF-8"?> 
 
<project name="Compress CSS-JS" default="compress" basedir="."> 
 
  <property file="bulid.properties" /> 
 
  <path id="yuiClasspath"> 
    <fileset dir="${lib}"> 
      <include name="*.*" /> 
    </fileset> 
  </path> 
 
  <!-- #######################Init the environment of the tool ##########################--> 
  <target name="init"> 
    <echo message="begin to init the init" /> 
    <echo message="delete all reference files." /> 
    <delete dir="${output.dir}" /> 
    <echo message="delete end" /> 
    <echo message="make the reference files." /> 
    <mkdir dir="${output.dir}" /> 
    <mkdir dir="${output.temp.dir}" /> 
    <echo message="make end." /> 
  </target> 
 
  <!-- #######################Combine the css files       ##########################--> 
  <target name="combinecss" depends="init" description="Combine common css files"> 
    <echo message="begin to combine the css files to one file." /> 
    <concat destfile="${output.temp.dir}/combined_css.css" encoding="UTF-8" append="false"> 
      <fileset dir="${commonCss.dir}"> 
        <include name="*.css" /> 
      </fileset> 
    </concat> 
    <echo message="combine end." /> 
  </target> 
 
  <!-- #######################Combine the js files       ##########################--> 
  <target name="combinejs"> 
    <echo message="begin to combine the js files to one file." /> 
    <concat destfile="${output.temp.dir}/all_source.js" encoding="utf-8" append="false"> 
      <fileset dir="${commonJs.dir}"> 
        <include name="*.js" /> 
      </fileset> 
    </concat> 
    <echo message="combine end." /> 
  </target> 
 
  <!-- #######################Compress the js and css files ##########################--> 
  <target name="compress" depends="combinecss,combinejs" description="Compress"> 
    <echo message="begin to compress the css file." /> 
    <taskdef name="yuicompress" classname="com.yahoo.platform.yui.compressor.YUICompressTask"> 
      <classpath> 
        <path refid="yuiClasspath" /> 
      </classpath> 
    </taskdef> 
    <!-- first method compress the css files --> 
    <yuicompress linebreak="10000000" warn="false" munge="yes" preserveallsemicolons="true" outputfolder="${output.dir}"> 
      <fileset dir="${output.temp.dir}"> 
        <include name="*.css" /> 
      </fileset> 
    </yuicompress> 
    <echo message ="compress the css end." /> 
    <!-- second method compress the js files--> 
    <echo message ="begin to compress the js file." /> 
    <apply executable="java" parallel="false" failonerror="true"> 
      <fileset dir="${output.temp.dir}" includes="all_source.js" /> 
      <arg line="-jar" /> 
      <arg path="${lib}/yuicompressor-2.4.6.jar" /> 
      <arg line="--charset utf-8" /> 
      <arg line="-o ${output.dir}/combined_js.js" /> 
      <srcfile /> 
    </apply> 
    <echo message ="compress the js end." /> 
    <delete dir="${output.temp.dir}" /> 
  </target> 
 
</project> 
 
@echo off 
echo ################################################ 
echo ##########Tool Compress the js and css########## 
echo ################################################ 
echo Please make sure your css and js in the css'directory and js'directory. 
echo If sure,please enter any button to continue the tool. 
pause 
call ant -buildfile compress.xml compress>build.log 
echo compress end  
pause 

 
 相關(guān)的文件我提供下載,感覺好的,就留言吧

相關(guān)文章

  • php封裝一個異常的處理類

    php封裝一個異常的處理類

    這篇文章主要為大家詳細介紹了php封裝一個異常的處理類,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • PHP下的Oracle客戶端擴展(OCI8)安裝教程

    PHP下的Oracle客戶端擴展(OCI8)安裝教程

    這篇文章主要介紹了PHP下的Oracle客戶端擴展(OCI8)安裝教程,本文在Linux系統(tǒng)中實現(xiàn),OCI8是用來連接Oracle數(shù)據(jù)庫的PHP擴展模塊,需要的朋友可以參考下
    2014-09-09
  • thinkPHP5.0框架應(yīng)用請求生命周期分析

    thinkPHP5.0框架應(yīng)用請求生命周期分析

    這篇文章主要介紹了thinkPHP5.0框架應(yīng)用請求生命周期,較為詳細的分析了thinkPHP5.0框架應(yīng)用請求生命周期所涉及的各個執(zhí)行流程,需要的朋友可以參考下
    2017-03-03
  • php基于CodeIgniter實現(xiàn)圖片上傳、剪切功能

    php基于CodeIgniter實現(xiàn)圖片上傳、剪切功能

    這篇文章主要為大家詳細介紹了php基于CodeIgniter實現(xiàn)圖片上傳、剪切功能,具有參考價值,感興趣的朋友可以參考一下
    2016-05-05
  • yii框架配置默認controller和action示例

    yii框架配置默認controller和action示例

    這篇文章主要介紹了yii框架配置默認controller和action示例,需要的朋友可以參考下
    2014-04-04
  • thinkPHP實現(xiàn)表單自動驗證

    thinkPHP實現(xiàn)表單自動驗證

    這篇文章主要介紹了如何使用thinkPHP實現(xiàn)表單自動驗證,筆者也是菜鳥,一步步實驗才得到的結(jié)果,這里給需要的朋友可以參考下
    2014-12-12
  • thinkPHP中驗證碼的簡單實現(xiàn)方法

    thinkPHP中驗證碼的簡單實現(xiàn)方法

    這篇文章主要介紹了thinkPHP中驗證碼的簡單實現(xiàn)方法,結(jié)合實例形式分析了thinkPHP驗證碼的實現(xiàn)原理、步驟與調(diào)用技巧,需要的朋友可以參考下
    2016-12-12
  • PhpStorm2020 + phpstudyV8 +XDebug的教程詳解

    PhpStorm2020 + phpstudyV8 +XDebug的教程詳解

    這篇文章主要介紹了PhpStorm2020 + phpstudyV8 +XDebug的教程詳解,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-09-09
  • Symfony核心類概述

    Symfony核心類概述

    這篇文章主要介紹了Symfony核心類,簡單分析了Symfony的核心類,組織結(jié)構(gòu)及對應(yīng)的功能,需要的朋友可以參考下
    2016-03-03
  • 比較完整的微信開發(fā)php代碼

    比較完整的微信開發(fā)php代碼

    這篇文章主要為大家介紹了比較完整的微信開發(fā)php代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-08-08

最新評論

淅川县| 永州市| 秀山| 景宁| 灵山县| 卢湾区| 班玛县| 南昌市| 乌兰县| 斗六市| 彭泽县| 商城县| 格尔木市| 吉安市| 万宁市| 通渭县| 阿鲁科尔沁旗| 阳江市| 墨竹工卡县| 叙永县| 炎陵县| 恩施市| 旬邑县| 二连浩特市| 罗定市| 安阳市| 缙云县| 高安市| 马尔康县| 贡觉县| 高台县| 特克斯县| 洮南市| 伊春市| 哈巴河县| 鹿邑县| 棋牌| 宁夏| 满城县| 安乡县| 贺兰县|