Created
July 31, 2017 13:10
-
-
Save XOP/9eab2ac64c490ec362e7629b9d04270b to your computer and use it in GitHub Desktop.
csslint for node analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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