誰かが、 nant-scriptからnant -taskとしてMicrosoftAjaxMinifierを使用する方法を説明してもらえますか。Visual Studioでの使用方法の例を見てきましたが、CIサーバーで縮小を実行したいと思います。
4 に答える
3
MS Ajax Minifier について具体的にはわかりませんが、Yahoo! UI ライブラリ: .Net作業用の YUI コンプレッサー。
- .NET 用の YUI Compressor アセンブリをダウンロード
- サンプル MSBuild.xml ファイルを変更しました
- MSBuild タスクを実行するように nAnt スクリプトを変更しました (詳細はこちら: NAnt と MSBuild タスクを使用して .Net 2.0 プロジェクトをビルドおよび公開する) 。
于 2009-11-02T18:45:19.833 に答える
1
これは私が使用するコードです。ajaxminifier を使用してフォルダー内のすべての *.js および *.css を縮小します
<foreach item="File" property="filename">
<in>
<items>
<include name="${deployment.dir}\js\*.js"></include>
<include name="${deployment.dir}\css\*.css"></include>
</items>
</in>
<do>
<echo message="Minifying ${filename} and overwritting file"/>
<exec program="${ajaxminifier.exe}"
workingdir="."
failonerror="true"
commandline='-clobber:true ${filename} -o ${filename}'/>
</do>
</foreach>
このスクリプトは、ファイルを縮小版 ( -clobber:true arg を使用) で上書きすることに注意してください。${ajaxminifier.exe} は、ajaxmin.exe へのパスです。
于 2010-05-14T09:05:41.183 に答える
0
<foreach item="File" property="Debugfile" >
<in>
<items>
<include name="**\*.debug.js"/>
</items>
</in>
<do failonerror="false">
<regex pattern="^(?'filename'.*)\.(?'extension2'\w+)\.(?'extension3'\w+)$" input="${Debugfile}" />
<regex pattern="^(?'path'.*(\\|/)|(/|\\))(?'file'.*)$" input="${Debugfile}" />
<echo message="renaming with filename=${path},file=${file}"/>
<exec program="${Minifie.lib}\ajaxmin.exe" commandline="${filename}.debug.js -o ${filename}.js" failonerror="true"/>
</do>
</foreach>
于 2010-05-12T05:03:30.780 に答える
0
description="AjaxminFilesCreation.">
<foreach item="File" property="Debugfile" >
<in>
<items>
<include name="**\*.debug.js"/>
</items>
</in>
<do failonerror="false">
<regex pattern="^(?'filename'.*)\.(?'extension2'\w+)\.(?'extension3'\w+)$" input="${Debugfile}" />
<regex pattern="^(?'path'.*(\\|/)|(/|\\))(?'file'.*)$" input="${Debugfile}" />
<echo message="renaming with filename=${path},file=${file}"/>
<exec program="${Minifie.lib}\ajaxmin.exe" commandline="${filename}.debug.js -o ${filename}.js" failonerror="true"/>
</do>
</foreach>
</target>
于 2010-05-12T05:44:18.937 に答える