YUI Compressor与Ant集成方案概述
近期对Yahoo开源的YUI框架进行了深入研究,其功能表现令人印象深刻。
为此,我开发了一套基于Ant的YUI集成方案。鉴于网络上多见的批处理脚本实现,本文另辟蹊径,提供独特的Ant构建指南。如需转载,请注明作者及来源网站。
版权所有:Mr.chen
具体实施步骤如下所述:
官方资源地址:
核心组件 yuicompressor-2.4.6.jar 可从以下链接获取:http://yuilibrary.com/downloads/#yuicompressor
辅助插件 YUIAnt.jar 下载链接为:http://www.ubik-ingenierie.com/miscellanous/YUIAnt/
相关配置代码示例如下:
#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"?>
@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
完整相关文件包已提供下载,若觉得有用,欢迎留言反馈。