postcss-annotation-extend

1.0.1 • Public • Published

postcss-annotation-extend Build Status

PostCSS plugin for annotations based inheritance from other rule sets

Installation

$ npm install postcss-annotation-extend

Example

// Dependencies
var fs = require("fs")
var postcss = require("postcss")
var extend = require("postcss-annotation-extend")
 
// CSS to be processed
var css = fs.readFileSync("input.css", "utf8")
 
// Process css
var output = postcss()
  .use(extend(css))
  .process(css)
  .css

Using this input.css:

.base-1 {
  /*
   * @base
   */
  font-size: 12px;
}
 
.base-2 {
  /*
   * @base
   */
  color: red;
}
 
.foo {
  /*
   * @extend .base-1, .base-2
   */
   padding: 10px;
}
 
.bar {
  /*
   * @extend .base-1
   */
   margin: 10px;
}

You will get:

.foo,
.bar {
  /*
   * @base
   */
  font-size: 12px;
}
 
.foo {
  /*
   * @base
   */
  color: red;
}
 
.foo {
  /*
   * @extend .base-1, .base-2
   */
   padding: 10px;
}
 
.bar {
  /*
   * @extend .base-1
   */
   margin: 10px;
}

License

The MIT License (MIT)

Copyright (c) 2014 Masaaki Morishita

Dependents (1)

Package Sidebar

Install

npm i postcss-annotation-extend

Weekly Downloads

12

Version

1.0.1

License

MIT

Last publish

Collaborators

  • morishitter