2.0.0 • Published 5 years ago

scss-validator v2.0.0

Weekly downloads
5
License
MIT
Repository
gitlab
Last release
5 years ago

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

ParamTypeDescription
configObjectInformation about the configFile.
configObject.srcDirstringThe source directory for sccs. default value "."
configObject.srcFilestringThe single scss file. if provided only single file will be scaned.
configObject.ignoreFilesArray.<string>The ignoreFiles. default value []
configObject.spaceTagClassNameCheckArray.<string>Array of html tag ClassName to chek in scss. default value 'body', 'div', 'span','a'
configObject.containTagClassNameCheckArray.<string>Array of contain html tag ClassName to chek in scss. default value []

Rules

  1. root classname should be "filename"-component
  2. there should be only one root class in scss file
  3. spaceTagClassNameCheck i.e this html tag selectors are not allowed.

    1. not allowed example :
    .card {
        body {
            color : red;
        }
    }
    1. not allowed example :
    .drop-down {
        div {
            color : blue;
        }
    }
  4. containTagClassNameCheck same as spaceTagClassNameCheck but containg keyword classname not allowed

Tests

npm install
npm test

Dependencies

  • fs:
  • glob: a little globber
  • path: Node.JS path module
  • readline: Simple streaming readline module.

Dev Dependencies

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