Skip to content
PostCSS plugin for color shortcuts
JavaScript
Branch: master
Clone or download
Latest commit 90fd11a Apr 24, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.babelrc Add ava instead of mocha Jul 4, 2016
.editorconfig Initial commit Jul 31, 2015
.eslintignore Add eslint Jul 4, 2016
.eslintrc.json Add eslint Jul 4, 2016
.gitignore Some tweaks Jul 4, 2016
.travis.yml Add latest node to travis and drop node 0.10 Jul 4, 2016
LICENSE Add license Apr 24, 2017
README.md Docs Dec 25, 2015
index.js Add eslint Jul 4, 2016
package.json 0.2.4 Apr 24, 2017
test.js Add ava instead of mocha Jul 4, 2016

README.md

postcss-color-short Build Status

PostCSS 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

You can’t perform that action at this time.