Skip to content

Instantly share code, notes, and snippets.

@XOP
Created July 31, 2017 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XOP/9eab2ac64c490ec362e7629b9d04270b to your computer and use it in GitHub Desktop.
Save XOP/9eab2ac64c490ec362e7629b9d04270b to your computer and use it in GitHub Desktop.
csslint for node analysis
const fs = require('fs');
const path = require('path');
const buildPath = 'build/public';
const csslint = require('csslint').CSSLint;
const buildCSSPath =
fs.readdirSync(buildPath)
.filter(f => f.indexOf('.css') > -1)
.filter(f => f.indexOf('.map') === -1);
const buildCSSFile = fs.readFileSync(path.join(buildPath, buildCSSPath[0]), 'utf8');
const cssLintResult = csslint.verify(buildCSSFile);
cssLintResult.messages
.filter(m => m.type === 'error')
.forEach(m => console.log(m.message));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment