felixmosh / postcss-extract-styles

PostCSS plugin that extracts styles from css based on decelerations matching.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostCSS Extract Styles Build Status npm

PostCSS plugin that extracts styles from css based on deceleration matching.

Options

pattern : Regex | Array

Usage

const options = {
  pattern: /{{[^\}]+}}/g
};
postcss([ require('postcss-extract-styles')(options) ]
  .then((result) => {
     result.css // will be the "remain" part
     result.extracted // will be the "extracted" part
  });

Example

.wix-tpa {
	color: {{color-1}};
	margin-left: 10px;
}
// remain
.wix-tpa {
  margin-left: 10px;
}
// extracted
.wix-tpa {
  color: {{color-1}};
}

Testing

$ npm test

See PostCSS docs for examples for your environment.

About

PostCSS plugin that extracts styles from css based on decelerations matching.

License:MIT License


Languages

Language:JavaScript 58.7%Language:CSS 41.3%