postcss-color-short

PostCSS plugin for color shortcuts

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
postcss-color-short
0.2.47 years ago9 years agoMinified + gzip package size for postcss-color-short in KB

Readme

PostCSSpostcss plugin for color shortcuts

For hexadecimal, rgb and rgba
/* before */

.hello {
  border-bottom: 1px solid rgb(200);
  background: #20;
  color: #f;
  box-shadow: 0 1px 5px rgba(0, 0.5);
}

/* after */

.hello {
  border-bottom: 1px solid rgb(200, 200, 200);
  background: #202020;
  color: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

Install

npm install --save-dev postcss-color-short

Usage

PostCSS

var fs = require('fs');
var postcss = require('postcss');
var colorShort = require('postcss-color-short');
var css = fs.readFileSync('input.css', 'utf8');

var output = postcss([colorShort])
  .process(css)
  .css;

Gulp

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var colorShort = require('postcss-color-short');

gulp.task('css', function () {
  return gulp.src('./src')
    .pipe(postcss([
      colorShort
    ]))
    .pipe(gulp.dest('./dist'));
});

License

MIT