Skip to content

Commit

Permalink
fix: detect posthtml
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Feb 20, 2018
1 parent 9a08805 commit 9251b0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/post-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9251b0b

Please sign in to comment.