postcss-customize-plugin

1.0.0 • Public • Published

postcss-customize-plugin

this plugin used to handle postcss ast, so you can modify postcss result but not must to publish an npm package

这个插件的目的是,在网上插件无法满足需求的情况下,对css结果进行简单的处理,而不需要发布一个新的npm包,或者postcss plugin

Install

npm install --save-dev postcss-customize-plugin 

Basic usage

gulpfile.js

var myplugin = require('postcss-customize-plugin');
 
gulp.task('css', function () {
    var processors = [
        myplugin({
            handle: function (css) { // ast object
                css.walkAtRules(function (rule) {
                    if (rule.name === 'xxxxx') {
                        rule.remove()
                    }
                });
            }
        })
    ];
    return gulp.src('./src/*.css')
        .pipe(postcss(processors))
        .pipe(gulp.dest('./dest'));
});

or

postcss.config.js

let conf = {
  'plugins': {
    'postcss-customize-plugin': {
      handle: function(css) { // the same as above
        // ...xxxx
      }
    }
  }
}
 
module.exports = conf

Dependents (0)

Package Sidebar

Install

npm i postcss-customize-plugin

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

1.71 kB

Total Files

3

Last publish

Collaborators

  • singleparty