Skip to content

Commit 1552eab

Browse files
author
Adam Gruber
committed
Create plugin factory to return plugin instances
1 parent 80c8e3a commit 1552eab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/plugin.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const transformVars = require('./transformVars');
2+
3+
/*
4+
* Define factory to create plugins that convert SASS variables to JS object
5+
*
6+
* @param {object} [opts] Options to pass to the `transformVars` method
7+
*
8+
* @return {SassExtractPluginInstance}
9+
*/
10+
const sassExtractJs = opts => ({
11+
run: () => ({
12+
postExtract: extractedVariables => transformVars(extractedVariables.global, opts),
13+
}),
14+
});
15+
16+
module.exports = sassExtractJs;

0 commit comments

Comments
 (0)