Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hello-ant-js a simple ant configuration exemple
css_dir = css
js_dir = js
assets_dir = assets
<?xml version="1.0"?>
<project name="Compress, Concatenate, and FTP CSS and JS " default="initialize">
<target name="hello_ant">
<echo>Hello Ant!</echo>
</target>
<!-- cible initiale -->
<target name="initialize" depends="get_properties">
<mkdir dir="${assets_dir}"/>
<antcall target="compress_all"/>
</target>
<target name="clean_up" depends="get_properties">
<delete dir="${assets_dir}"/>
</target>
<target name="compress_all">
<antcall target="compress_css"/>
<antcall target="compress_js"/>
</target>
<target name="get_properties">
<!-- importer le fichier de propri?t?s externes-->
<property file="ant.properties"></property>
<echo>Imported Properties</echo>
</target>
<target name="compress_css" depends="get_properties">
<antcall target="compress">
<param name="dir" value="${css_dir}"/>
<param name="file" value="style.css"/>
</antcall>
</target>
<target name="compress_js" depends="get_properties">
<antcall target="compress">
<param name="dir" value="${js_dir}"/>
<param name="file" value="script.js"/>
</antcall>
</target>
<target name="compress" depends="get_properties">
<!-- les répertoires requis seront crées -->
<mkdir dir="${assets_dir}/${dir}"/>
<java fork="true" jar="C:\jar\yuicompressor-2.4.7.jar">
<arg value="${dir}/${file}"/>
<arg value="-o"/>
<arg value="${assets_dir}/${dir}/${file}"/>
</java>
<echo>${file}</echo>
</target>
<target name="upload_files" depends="initialize,get_properties">
<echo>
Uploading files on the server.
</echo>
<ftp server="ftpperso.free.fr"
userid="login"
password="pass"
port="21"
remotedir="/"
passive="yes"
binary="true">
<fileset dir="${assets_dir}">
</fileset>
<fileset dir=".">
<include name="index.html"/>
</fileset>
</ftp>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment