1.0.5 • Published 8 years ago

gulp-css-hairline v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

gulp-css-hairline

Dispose with the CSS border pixels, refer to CSS retina hairline

Build Status

Javascript

if (window.devicePixelRatio && devicePixelRatio >= 2) {
  var testElem = document.createElement('div');
  testElem.style.border = '.5px solid transparent';
  document.body.appendChild(testElem);
  if (testElem.offsetHeight == 1)
  {
    document.querySelector('html').classList.add('hairline');
  }
  document.body.removeChild(testElem);
}

Install

$ npm install --save-dev gulp-css-hairline

Usage

var gulp = require('gulp');
var hairline = require('gulp-css-hairline');

gulp.task('default', function () {
    return gulp.src('assets/input.css')
        .pipe(hairline())
        .pipe(gulp.dest('dist/'));
});

Options

options.htmlCls

Type: String

Default value: hairline

Note: html's className.

Ignore a specific style

You can ignore a style with a comment /*hairline:skip*/.

.ignored{
  border:1px #000 solid; /*hairline:skip*/
}

License

Copyright (c) 2015 Cao Ren under the MIT License.

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago