diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-30 16:45:38 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-30 16:45:38 +0800 |
| commit | a0579f91bbdf0de62b59df381d97a008bb98df57 (patch) | |
| tree | 69c21333750c7bc7358f9383560438048d9adebf /node_modules/oldie/index.js | |
| parent | 2d8aeba452672bcda2096e5d76bf37131c34075e (diff) | |
update/upgrade
Diffstat (limited to 'node_modules/oldie/index.js')
| -rw-r--r-- | node_modules/oldie/index.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/node_modules/oldie/index.js b/node_modules/oldie/index.js new file mode 100644 index 00000000..557b2d5c --- /dev/null +++ b/node_modules/oldie/index.js @@ -0,0 +1,71 @@ +var assign = require('object-assign'); +var postcss = require('postcss'); + +var processors = [ + { + plugin: require('postcss-calc'), + namespace: 'calc', + defaults: {} + }, + { + plugin: require('postcss-unmq'), + namespace: 'media', + defaults: {} + }, + { + plugin: require('postcss-unroot'), + namespace: 'root', + defaults: {} + }, + { + plugin: require('postcss-unnth'), + namespace: 'nth', + defaults: {} + }, + { + plugin: require('postcss-unnot'), + namespace: 'not', + defaults: {} + }, + { + plugin: require('postcss-unopacity'), + namespace: 'opacity', + defaults: {} + }, + { + plugin: require('postcss-unrgba'), + namespace: 'rgba', + defaults: {} + }, + { + plugin: require('pixrem'), + namespace: 'rem', + defaults: { + replace: true + } + }, + { + plugin: require('postcss-pseudoelements'), + namespace: 'pseudo', + defaults: {} + } +]; + +module.exports = postcss.plugin('oldie', function (opts) { + opts = assign({}, opts); + + var instance = postcss(); + + processors.forEach(function (processor) { + var namespaceOptions = processor.namespace in opts ? opts[processor.namespace] : opts; + var processorOptions = {}; + + processorOptions = assign({}, processor.defaults, namespaceOptions); + + if (namespaceOptions && !processorOptions.disable) { + instance.use(processor.plugin(processorOptions)); + } + }); + + return instance; +}); |
