2.1.1 • Published 4 years ago

postcss-unwrap-at-media v2.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

PostCSS Unwrap @media

Build Status

PostCSS plugin to unwrap @media rules to make styles IE8 (and older) friendly.

/* Input example */
.block {
  width: 100%;
}
@media (min-width: 720px) {
  .block {
    float: left;
    width: 25%;
  }
}
/* Output example */
.block {
  width: 100%;
}
.block {
  float: left;
  width: 25%;
}

Usage

Basic usage:

postcss([ require('postcss-unwrap-at-media') ])

Here is an example of Gulpfile which create two versions of styles:

var gulp = require('gulp');
var less = require('gulp-less');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var unwrapAtMedia = require('postcss-unwrap-at-media');
 
gulp.task('default', function () {
  return gulp.src('./src/**/*.less')
    .pipe(less())
    .pipe(gulp.dest('./dist/'))
    .pipe(postcss([ unwrapAtMedia ]))
    .pipe(rename({ suffix: '.ie8' }))
    .pipe(gulp.dest('./dist/'));
});

See PostCSS docs for examples for your environment.