Skip to content

Commit

Permalink
✨ Add color for log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kghugo committed Aug 4, 2020
1 parent ca0ecba commit 5d431c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utilities/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const {
options
} = require('../index.js')

const chalk = require('chalk');

const hasWrappedInRFS = (decl) => /^rfs/g.test(decl.value)

const isIncluded = (decl, inclusionRules) => {
Expand Down Expand Up @@ -31,12 +33,12 @@ const shouldBeTransformed = (decl, options) => {

for(const [index, value] of validationValues.entries() ){
if(! isIncluded(value, inclusionRules[index]) || isIncluded(value, exclusionRules[index]) ){
console.log(`${decl.parent.selector}{ ${decl.prop}: ${decl.value} } has been excluded`);
console.log(chalk.red(`${decl.parent.selector}{ ${decl.prop}: ${decl.value} } has been excluded`));
return false
}
}

console.log(`${decl.parent.selector}{ ${decl.prop}: ${decl.value} } has been wrapped with rfs()`);
console.log(chalk.green(`${decl.parent.selector}{ ${decl.prop}: ${decl.value} } has been wrapped with rfs()`));
return true
}

Expand Down

0 comments on commit 5d431c7

Please sign in to comment.