-
Notifications
You must be signed in to change notification settings - Fork 483
Build System Integration
CSS Lint fits in well with any existing build or automation scripts.
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.
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.
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>
Once you've created the target name, you can run from the command line via:
ant csslint
It is easy to include CSS Lint as part of your build system using maven. There is a maven plugin available which is easy to configure:
<plugins>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<goals>
<goal>csslint</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Read more about wro4j-maven-plugin.