Last Updated: February 25, 2016
·
1.804K
· MidnightLightning

PHP by Ant

Ant build scripts are designed for languages that need to be compiled, so for PHP web applications, there's not much need. However, auxiliary tools are making it useful to have some build scripts on hand.

Template

Your basic Ant template looks something like:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MySite.com" default="default" basedir=".">
  <description>
    simple example build file
  </description>
  <target name="default">
    <exec executable="dir"></exec>
  </target>
</project>

Compass (CSS)

If you have a configuration file for your project set up properly, you just need:

<target name="compass">
  <exec executable="compass">
    <arg value="compile"/>
    <arg value="--environment"/>
    <arg value="production"/>
  </exec>
</target>

If you want all the configuration options set in the build script:

<target name="compass">
  <exec executable="compass">
    <arg value="compile"/>
    <arg value="--css_dir=inc"/>
    <arg value="--sass_dir=sass"/>
    <arg value="--output_style=compact"/>
  </exec>
</target>

SASS (CSS)

<pre class="prettyprint">
<target name="default">
  <exec executable="sass">
    <arg value="--style"/>
    <arg value="compact"/>
    <arg value="inc/main.scss:inc/main.css"/>
  </exec>
</target>
</pre>

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside