GithubHelp home page GithubHelp logo

csslint-maven-plugin's Introduction

Maven CSS Lint plugin

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.

Configuration

Schema

<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>

Parameters

errors

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-classesDon't use adjoining classes.
box-modelDon't use width or height when using padding or border.
box-sizingThe box-sizing properties isn't supported in IE6 and IE7.
compatible-vendor-prefixesInclude all compatible vendor prefixes to reach a wider range of users.
display-property-groupingCertain properties shouldn't be used with certain display property values.
duplicate-propertiesDuplicate properties must appear one after the other.
empty-rulesRules without any properties specified should be removed.
errorsThis rule looks for recoverable syntax errors.
floatsThis rule tests if the float property is used too many times
font-facesToo many different web fonts in the same stylesheet.
font-sizesChecks the number of font-size declarations.
gradientsWhen using a vendor-prefixed gradient, make sure to use them all.
idsSelectors should not contain IDs.
importDon't use @import, use instead.
importantBe careful when using !important declaration
known-propertiesProperties should be known (listed in CSS specification) or be a vendor-prefixed property.
outline-noneUse of outline: none or outline: 0 should be limited to :focus rules.
overqualified-elementsDon't use classes or IDs with elements (a.foo or a#foo).
qualified-headingsHeadings should not be qualified (namespaced).
regex-selectorsSelectors that look like regular expressions are slow and should be avoided.
rules-countTrack how many rules there are.
shorthandUse shorthand properties where possible.
text-indentChecks for text indent less than -99px
unique-headingsHeadings should be defined only once.
universal-selectorThe universal selector (*) is known to be slow.
vendor-prefixWhen using a vendor-prefixed property, make sure to include the standard one.
zero-unitsYou don't need to specify units when a value is 0.
  • Type: List
  • Required: No
warnings

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-classesDon't use adjoining classes.
box-modelDon't use width or height when using padding or border.
box-sizingThe box-sizing properties isn't supported in IE6 and IE7.
compatible-vendor-prefixesInclude all compatible vendor prefixes to reach a wider range of users.
display-property-groupingCertain properties shouldn't be used with certain display property values.
duplicate-propertiesDuplicate properties must appear one after the other.
empty-rulesRules without any properties specified should be removed.
errorsThis rule looks for recoverable syntax errors.
floatsThis rule tests if the float property is used too many times
font-facesToo many different web fonts in the same stylesheet.
font-sizesChecks the number of font-size declarations.
gradientsWhen using a vendor-prefixed gradient, make sure to use them all.
idsSelectors should not contain IDs.
importDon't use @import, use instead.
importantBe careful when using !important declaration
known-propertiesProperties should be known (listed in CSS specification) or be a vendor-prefixed property.
outline-noneUse of outline: none or outline: 0 should be limited to :focus rules.
overqualified-elementsDon't use classes or IDs with elements (a.foo or a#foo).
qualified-headingsHeadings should not be qualified (namespaced).
regex-selectorsSelectors that look like regular expressions are slow and should be avoided.
rules-countTrack how many rules there are.
shorthandUse shorthand properties where possible.
text-indentChecks for text indent less than -99px
unique-headingsHeadings should be defined only once.
universal-selectorThe universal selector (*) is known to be slow.
vendor-prefixWhen using a vendor-prefixed property, make sure to include the standard one.
zero-unitsYou don't need to specify units when a value is 0.
  • Type: List
  • Required: No
baseDirectory

The directory to scan. The directory used by 'includes' and 'excludes' options.

  • Type: List
  • Required: No
  • Default: ${project.basedir}
includes

List of includes patterns (Ant patterns). For more information about pattern's syntax check documentation.

  • Type: List
  • Required: Yes
excludes

List of excludes patterns (Ant patterns). For more information about pattern's syntax check documentation.

  • Type: List
  • Required: No
format

The output format.

Console formats:

textthe default format
compacta 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-xmlan XML format that can be consumed by other utilities
csslint-xmlsame as lint-xml except the document element is <csslint>
checkstyle-xmla format appropriate for consumption by Checkstyle
  • Type: String
  • Required: No
  • Default: text

Additional information

  • check goal is attached to verify phase;

Usage

Verifying CSS files with all available rules

Definition
<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>
Command

To check for CSS issues execute:

mvn verify

Contributors

Creators

  1. Tomasz Oponowicz

Contributors

  1. Piotr Kuczyński

csslint-maven-plugin's People

Contributors

tomasz-oponowicz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

csslint-maven-plugin's Issues

Unable to build package for version 0.8.1

  • Download version 0.8.1
  • Run mvn clean package
  • Build fails with
    [INFO] Building: test-csslint-xml-format/pom.xml
    [INFO] ..SUCCESS (17.8 s)
    [INFO] Building: test-compact-format/pom.xml
    [INFO] ..SUCCESS (5.1 s)
    [INFO] Building: test-implcit-text-format/pom.xml
    [INFO] ..SUCCESS (5.2 s)
    [INFO] Building: test-syntax-errors/pom.xml
    [INFO] ..FAILED (5.1 s)
    [INFO]   The post-build script did not succeed. Expression: allOutput.contains(BUILD FAILURE)
    [INFO] Building: test-checkstyle-xml-format/pom.xml
    [INFO] ..SUCCESS (5.1 s)
    [INFO] Building: test-no-errors/pom.xml
    [INFO] ..SUCCESS (5.0 s)
    [INFO] Building: test-single-file/pom.xml
    [INFO] ..SUCCESS (5.2 s)
    [INFO] Building: test-lint-xml-format/pom.xml
    [INFO] ..SUCCESS (5.2 s)
    [INFO] Building: test-custom-error-rules/pom.xml
    [INFO] ..FAILED (5.1 s)
    [INFO]   The post-build script did not succeed. Expression: allOutput.contains(BUILD FAILURE)
    [INFO] Building: test-multiple-files/pom.xml
    [INFO] ..SUCCESS (5.5 s)
    [INFO] Building: test-custom-warning-rules/pom.xml
    [INFO] ..SUCCESS (5.0 s)
    [INFO] -------------------------------------------------
    [INFO] Build Summary:
    [INFO]   Passed: 9, Failed: 2, Errors: 0, Skipped: 0
    [INFO] -------------------------------------------------
    [ERROR] The following builds failed:
    [ERROR] *  test-syntax-errors/pom.xml
    [ERROR] *  test-custom-error-rules/pom.xml

Add failOnWarning option

Currently the build does not fail if cssLint warnings are thrown.

Can a 'failOnWarning' option be added

Add excludes option

Can an excludes option be added, i.e. the inverse of the includes

...
<excludes>
    <exclude>foo.css</exclude>
    <exclude>lib/**/*.css</exclude>
</excludes>
....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.