Skip to content

rpsh/postcss-split-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostCSS Split CSS

Split the specified css rules into another file.

Installation

npm install postcss-split-css --save-dev

Usage

splitCss = require("postcss-split-css");

postcss([
  splitCss({
    filter: [".lte_ie9", ".ie9", ".ie8"],
    output: {
      from: __dirname + "/src",
      dist: __dirname + "/dist",
      subfix: ".ie",
      append: "#__generated__{content:'" + new Date().toISOString() + "'}"
    }
  })
]);

Before:

/* style.css */
body{
	color: #000;
}
.lte_ie9 div{
	color: #f0f
}
.ie8 div{
	color: #f00
}
div {
    color: #ff0;
}

After:

/* style.css */
body{
	color: #000;
}
div {
    color: #ff0;
}
/* style.ie.css */
.lte_ie9 div{
	color: #f0f
}
.ie8 div{
	color: #f00
}

Inspired by PostCSS Filter Rules

About

Split the specified css rules into another file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published