Skip to content

Build System Integration

nzakas edited this page Oct 18, 2011 · 10 revisions

CSS Lint fits in well with any existing build or automation scripts.

Ant

It's easy to include CSS Lint as part of your Ant build system. The exact format of the task depends on which command line interface you're using.

Using Rhino

If you're using Rhino as your JavaScript engine, then make sure to download the Rhino version of CSS Lint from Git. Then, place the following target in your build.xml file:

<target name="csslint">       
    <apply executable="java" parallel="false" failonerror="true">
        <fileset dir="${src.dir}" includes="**/*.css" />
        <arg line="-jar"/>
        <arg path="${lib.dir}/js.jar"/>
        <arg path="${lib.dir}/csslint-rhino.js" />
        <srcfile/>
        <!-- your customized arguments go here -->
        <arg line="--warnings=box-model,floats --errors=ids,important"/>
    </apply>              
</target>

This target assumpts that src.dir is the location of your CSS files and that lib.dir is the location of both the Rhino JAR file (js.jar) as well as the csslint-rhino.js file.

Using Node.js

If you're using the Node.js version of CSS Lint, then ensure you've installed the latest version using npm. Once installed, you can use the following Ant target:

<target name="csslint">       
    <apply executable="csslint" parallel="false" failonerror="true">
        <fileset dir="${src.dir}" includes="**/*.css" />
        <srcfile/>
        <!-- your customized arguments go here -->
        <arg line="--warnings=box-model,floats --errors=ids,important"/>
    </apply>              
</target>

Usage

Once you've created the target name, you can run from the command line via:

ant csslint
Clone this wiki locally