JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53
  • Score
    100M100P100Q76733F
  • License MIT

A Gulp plugin for CSS Validation

Package Exports

  • gulp-w3c-css

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-w3c-css) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-w3c-css Build Status

A Gulp plugin for CSS Validation using W3C CSS Validation Service

Depends on w3c-css package.

var validate = require('gulp-w3c-css');

Usage

Validate all *.css files in the /css directory and write results to the /build directory. If there are no errors or warnings in a file, the resulting file will be empty. Otherwise the file will contain errors and warnings as JSON object:

{ "errors":[ /* ... */ ],"warnings":[ /* ... */ ] }
var path = require('path');
var gulp = require('gulp');
var gutil = require('gulp-util');

var srcPath = path.join(__dirname, './css/*.css');
var dstPath = path.join(__dirname, './build');

gulp.src(srcPath)
  .pipe(validate())
  .pipe(gulp.dest(dstPath));

OR

var srcPath = path.join(__dirname, './css/*.css');

var path = require('path');
var gulp = require('gulp');
var gutil = require('gulp-util');

gulp.src(srcPath)
  .pipe(validate())
  .pipe(gutil.buffer(function(err, files) {
    // err - an error encountered
    // files - array of validation results
    // files[i].contents is empty if there are no errors or warnings found
  }));

Arguments

The first argument to the validate function can be an options object with the following properties:

  • profile - the CSS profile used for the validation: css1, css2, css21, css3 [default: 'css3']
  • usermedium - the medium used for the validation: screen, print, ... [default: 'all']

Contact

[Grigoriy Chudnov] (mailto:g.chudnov@gmail.com)

License

Distributed under the The MIT License (MIT).