Skip to content

Commit adec8b0

Browse files
committed
added opportunity to easier extend the pipeline
1 parent cc377d8 commit adec8b0

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/index.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,25 @@ export default function setup(opts = {}) {
6363
return void (plugins = customPlugins);
6464
}
6565

66-
plugins = [];
67-
66+
const prepend = get('prepend', null, 'array', opts) || [];
67+
const append = get('append', null, 'array', opts) || [];
6868
const mode = get('mode', null, 'string', opts);
69-
plugins.push(mode
70-
? new LocalByDefault({mode: opts.mode})
71-
: LocalByDefault);
72-
7369
const createImportedName = get('createImportedName', null, 'function', opts);
74-
plugins.push(createImportedName
75-
? new ExtractImports({createImportedName: opts.createImportedName})
76-
: ExtractImports);
77-
7870
const generateScopedName = get('generateScopedName', null, 'function', opts);
79-
plugins.push(generateScopedName
80-
? new Scope({generateScopedName: opts.generateScopedName})
81-
: Scope);
71+
72+
plugins = [
73+
...prepend,
74+
mode
75+
? new LocalByDefault({mode: opts.mode})
76+
: LocalByDefault,
77+
createImportedName
78+
? new ExtractImports({createImportedName: opts.createImportedName})
79+
: ExtractImports,
80+
generateScopedName
81+
? new Scope({generateScopedName: opts.generateScopedName})
82+
: Scope,
83+
...append,
84+
];
8285
}
8386

8487
/**

utils/sugar.js

Whitespace-only changes.

0 commit comments

Comments
 (0)