2.0.0 • Published 5 years ago
scss-validator v2.0.0
scss-validator
This library will help to mandate rules for writing css in large enterprise UI component development.
Installation
This is a Node.js module available through the
npm registry. It can be installed using the
npm
or
yarn
command line tools.
npm install scss-validator --save
Usage
const scssObject = require('scss-validator');
const configObject = require('./SuccessScssConfig');
scssObject(configObject);
SuccessScssConfig.js - sample file
module.exports = {
'srcDir' : './src',
'srcFile' : '',
'ignoreFiles' : [ 'NoMatch.css'],
'spaceTagClassNameCheck' : ['body', 'div', 'span', 'a'],
'containTagClassNameCheck' : ['body', 'div' , 'span']
}
run(configObject)
A exported main function.
Kind: global function
Param | Type | Description |
---|---|---|
configObject | Information about the configFile. | |
configObject.srcDir | string | The source directory for sccs. default value "." |
configObject.srcFile | string | The single scss file. if provided only single file will be scaned. |
configObject.ignoreFiles | Array.<string> | The ignoreFiles. default value [] |
configObject.spaceTagClassNameCheck | Array.<string> | Array of html tag ClassName to chek in scss. default value 'body', 'div', 'span','a' |
configObject.containTagClassNameCheck | Array.<string> | Array of contain html tag ClassName to chek in scss. default value [] |
Rules
- root classname should be "filename"-component
- there should be only one root class in scss file
spaceTagClassNameCheck i.e this html tag selectors are not allowed.
- not allowed example :
.card { body { color : red; } }
- not allowed example :
.drop-down { div { color : blue; } }
containTagClassNameCheck same as spaceTagClassNameCheck but containg keyword classname not allowed
Tests
npm install
npm test
Dependencies
Dev Dependencies
- jsdoc-to-markdown: Generates markdown API documentation from jsdoc annotated source code
- np: A better
npm publish
- package-json-to-readme: Generate a README.md from package.json contents
License
MIT
2.0.0
5 years ago
1.25.0
6 years ago
1.24.0
6 years ago
1.23.0
6 years ago
1.22.0
6 years ago
1.21.0
6 years ago
1.20.0
6 years ago
1.19.0
6 years ago
1.18.0
6 years ago
1.17.0
6 years ago
1.16.0
6 years ago
1.15.0
6 years ago
1.14.0
6 years ago
1.13.0
6 years ago
1.12.0
6 years ago
1.11.0
6 years ago
1.5.0
6 years ago
1.1.0
6 years ago