0

I am writing Node cli application which will run locally installed CSSLint module by passing parameters. The CSSLint application is started from function cli which is in cli.js file (https://github.com/CSSLint/csslint/blob/master/dist/cli.js). How can I include this file and call cli function?

What I have tried.

  1. I have tried adding statement var csslint = require('csslint/dist/cli.js') but this just executes the CSSLint and I am able to pass parameters
MSK
  • 371
  • 2
  • 4
  • 14

1 Answers1

0

According to the documentation, if you y need to call CSSLint from your node application/script, you have to do the following:

var CSSLint = require('csslint').CSSLint;
var result = CSSLint.verify("h1 { color: red; }");
result.messages.forEach(function (message) {
    console.log("%s (line %d, col %d): %s", message.type, message.line, message.col, message.message);
});
saadtazi
  • 156
  • 2
  • 6