postcss-customize-plugin

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

Usage no npm install needed!

<script type="module">
  import postcssCustomizePlugin from 'https://cdn.skypack.dev/postcss-customize-plugin';
</script>

README

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