From 9251b0b4d74cc7ee7a6c0eb7303ad2af4a0343da Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Tue, 20 Feb 2018 14:57:45 +0300 Subject: [PATCH] fix: detect posthtml --- src/post-processor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/post-processor.js b/src/post-processor.js index f2e4c61..d64f2a7 100644 --- a/src/post-processor.js +++ b/src/post-processor.js @@ -3,12 +3,16 @@ export default (...args) => { throw new TypeError('post-processor did not receive any arguments.'); } - const ctx = args.find(ctx => Reflect.has(ctx, 'processor')); + let ctx = args.find(ctx => Reflect.has(ctx, 'processor')) || args.find(ctx => Reflect.has(ctx, 'name')); if (!ctx) { throw new TypeError('post-processor could not determine the process name.'); } + if (Reflect.has(ctx, 'name')) { + ctx = {processor: ctx}; + } + const { processor: { name, plugins } } = ctx; return {