0.1.0 • Published 5 years ago

postcss-unwrap-helper v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

postcss-unwrap-helper

Unwrap container contents with PostCSS

Install

$ npm install postcss-unwrap-helper
$ yarn add postcss-unwrap-helper

Usage

This is not a PostCSS plugin, just exposes a helper function that unwraps a node, preserving the correct whitespace.

import postcss from 'postcss';
import unwrapHelper from 'postcss-unwrap-helper';

// Am example plugin that unwraps all media queries
postcss.plugin('postcss-unwrap-all-media-queries', () => root => {
  root.walkAtRules('media', unwrapHelper);
};

Input CSS:

@media screen and (min-width: 960px) {
  div {
    display: block;
  }
}

span {
  display: flex;
}

Output CSS:

div {
  display: block;
}

span {
  display: flex;
}