Socket
Socket
Sign inDemoInstall

gulp-csslint

Package Overview
Dependencies
62
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.2 to 0.3.0

18

index.js

@@ -74,3 +74,3 @@ 'use strict';

cssLintPlugin.reporter = function(customReporter) {
cssLintPlugin.reporter = function(customReporter, options) {
var reporter = csslint.getFormatter('text');

@@ -80,2 +80,6 @@ var builtInReporter = true;

options = options || {};
var logger = options.logger || process.stdout.write.bind(process.stdout);
if (typeof customReporter === 'function') {

@@ -106,3 +110,3 @@ reporter = customReporter;

if (builtInReporter) {
output.push(reporter.formatResults(file.csslint.originalReport, file.path));
output.push(reporter.formatResults(file.csslint.originalReport, file.path, options));
}

@@ -117,10 +121,10 @@ else {

function(cb) {
var report;
if (builtInReporter) {
output.push(reporter.endFormat());
report = output.join('');
// Only print report if the report is not empty
report && gutil.log(report);
output
.filter(function(str) {
return str;
})
.forEach(logger);
}

@@ -127,0 +131,0 @@

{
"name": "gulp-csslint",
"version": "0.2.2",
"version": "0.3.0",
"description": "CSSLint plugin for gulp",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -105,2 +105,52 @@ # gulp-csslint [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependency status][david-image]][david-url]

### Reporter options
You can also pass options to the built-in formatter, by passing a second option to `reporter`.
```js
gulp.task('lint', function() {
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', options));
});
```
See the documentation for the formatters regarding what options they support.
This plugin supports one option outside of that, called `logger`, allowing you to specify how to log out the report.
Default is using `process.stdout.write`, but you can use e.g. `console.log`, or `gutil.log`.
```js
gulp.task('lint', function() {
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', {logger: console.log.bind(console)}));
});
```
```js
gulp.task('lint', function() {
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', {logger: gutil.log.bind(null, 'gulp-csslint:')}));
});
```
`logger` is called once for the starting format of the reporter, then once for each file containing violations, then
lastly once for the ending format. Instead of writing to `stdout`, you can write to file using this option.
```js
gulp.task('lint', function(cb) {
var fs = require('fs');
var output = '';
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', {logger: function(str) { output += str; }}));
fs.writeFile('some/path/junit.xml', output, cb);
});
```
This functionality is only available when not using custom reporters.
## Custom rules

@@ -107,0 +157,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc