The plugin has only one goal, called check
. This action verifies all CSS files and fails a compilation process in case of an error.
Note: Plugin isn't available in Maven central repository yet.
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>net.csslint</groupId>
<artifactId>csslint-maven-plugin</artifactId>
<version>0.8.1-patch01</version>
<configuration>
<errors>
<error/>
...
</errors>
<warnings>
<warning/>
...
</warnings>
<baseDirectory/>
<includes>
<include/>
...
</includes>
<excludes>
<exclude/>
...
</excludes>
<format/>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
...
</project>
List of rules that the tool uses. If the rule is matched, an error message is produced. Errors cause build failure. Errors tag has higher priority then warnings tag.
Available rules:
adjoining-classes | Don't use adjoining classes. |
box-model | Don't use width or height when using padding or border. |
box-sizing | The box-sizing properties isn't supported in IE6 and IE7. |
compatible-vendor-prefixes | Include all compatible vendor prefixes to reach a wider range of users. |
display-property-grouping | Certain properties shouldn't be used with certain display property values. |
duplicate-properties | Duplicate properties must appear one after the other. |
empty-rules | Rules without any properties specified should be removed. |
errors | This rule looks for recoverable syntax errors. |
floats | This rule tests if the float property is used too many times |
font-faces | Too many different web fonts in the same stylesheet. |
font-sizes | Checks the number of font-size declarations. |
gradients | When using a vendor-prefixed gradient, make sure to use them all. |
ids | Selectors should not contain IDs. |
import | Don't use @import, use instead. |
important | Be careful when using !important declaration |
known-properties | Properties should be known (listed in CSS specification) or be a vendor-prefixed property. |
outline-none | Use of outline: none or outline: 0 should be limited to :focus rules. |
overqualified-elements | Don't use classes or IDs with elements (a.foo or a#foo). |
qualified-headings | Headings should not be qualified (namespaced). |
regex-selectors | Selectors that look like regular expressions are slow and should be avoided. |
rules-count | Track how many rules there are. |
shorthand | Use shorthand properties where possible. |
text-indent | Checks for text indent less than -99px |
unique-headings | Headings should be defined only once. |
universal-selector | The universal selector (*) is known to be slow. |
vendor-prefix | When using a vendor-prefixed property, make sure to include the standard one. |
zero-units | You don't need to specify units when a value is 0. |
- Type: List
- Required: No
List of rules that the tool uses (if not specified all available rules are applied). If the rule is matched, a warning message is produced. Warnings don't cause build failure.
Available rules:
adjoining-classes | Don't use adjoining classes. |
box-model | Don't use width or height when using padding or border. |
box-sizing | The box-sizing properties isn't supported in IE6 and IE7. |
compatible-vendor-prefixes | Include all compatible vendor prefixes to reach a wider range of users. |
display-property-grouping | Certain properties shouldn't be used with certain display property values. |
duplicate-properties | Duplicate properties must appear one after the other. |
empty-rules | Rules without any properties specified should be removed. |
errors | This rule looks for recoverable syntax errors. |
floats | This rule tests if the float property is used too many times |
font-faces | Too many different web fonts in the same stylesheet. |
font-sizes | Checks the number of font-size declarations. |
gradients | When using a vendor-prefixed gradient, make sure to use them all. |
ids | Selectors should not contain IDs. |
import | Don't use @import, use instead. |
important | Be careful when using !important declaration |
known-properties | Properties should be known (listed in CSS specification) or be a vendor-prefixed property. |
outline-none | Use of outline: none or outline: 0 should be limited to :focus rules. |
overqualified-elements | Don't use classes or IDs with elements (a.foo or a#foo). |
qualified-headings | Headings should not be qualified (namespaced). |
regex-selectors | Selectors that look like regular expressions are slow and should be avoided. |
rules-count | Track how many rules there are. |
shorthand | Use shorthand properties where possible. |
text-indent | Checks for text indent less than -99px |
unique-headings | Headings should be defined only once. |
universal-selector | The universal selector (*) is known to be slow. |
vendor-prefix | When using a vendor-prefixed property, make sure to include the standard one. |
zero-units | You don't need to specify units when a value is 0. |
- Type: List
- Required: No
The directory to scan. The directory used by 'includes' and 'excludes' options.
- Type: List
- Required: No
- Default: ${project.basedir}
List of includes patterns (Ant patterns). For more information about pattern's syntax check documentation.
- Type: List
- Required: Yes
List of excludes patterns (Ant patterns). For more information about pattern's syntax check documentation.
- Type: List
- Required: No
The output format.
Console formats:
text | the default format |
compact | a more condensed output where each warning takes only one line of output |
External file formats (the location of the file is ${project.build.directory}/csslint.xml
):
lint-xml | an XML format that can be consumed by other utilities |
csslint-xml | same as lint-xml except the document element is <csslint> |
checkstyle-xml | a format appropriate for consumption by Checkstyle |
- Type: String
- Required: No
- Default: text
check
goal is attached toverify
phase;
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>net.csslint</groupId>
<artifactId>csslint-maven-plugin</artifactId>
<version>0.8.1-patch01</version>
<configuration>
<includes>
<include>**/*.css</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
...
</project>
To check for CSS issues execute:
mvn verify
- Tomasz Oponowicz
- Piotr Kuczyński