File tree 2 files changed +5
-8
lines changed
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,11 @@ let rootDir;
22
22
* @return {object }
23
23
*/
24
24
function load ( sourceString , sourcePath , trace , pathFetcher ) {
25
- // @todo To think about a better way to export tokens from the plugin
26
- let exportTokens = { } ;
27
-
28
- let result = postcss ( plugins . concat ( new parser ( { exportTokens, pathFetcher, trace } ) ) )
25
+ let result = postcss ( plugins . concat ( new parser ( { pathFetcher, trace } ) ) )
29
26
. process ( sourceString , { from : '/' + sourcePath } )
30
- . stringify ( ) ;
27
+ . root ;
31
28
32
- return { injectableSource : result . css , exportTokens : exportTokens } ;
29
+ return { injectableSource : result . css , exportTokens : result . tokens } ;
33
30
}
34
31
35
32
hook ( filename => {
Original file line number Diff line number Diff line change @@ -7,8 +7,7 @@ const importRegexp = /^:import\((.+)\)$/
7
7
export default plugin ( 'parser' , function ( opts ) {
8
8
opts = opts || { } ;
9
9
10
- // have to export it outside of the plugin :()
11
- let exportTokens = opts . exportTokens ;
10
+ let exportTokens = { } ;
12
11
let translations = { } ;
13
12
14
13
const fetchImport = ( importNode , relativeTo , depNr ) => {
@@ -63,5 +62,6 @@ export default plugin('parser', function (opts) {
63
62
fetchAllImports ( css ) ;
64
63
linkImportedSymbols ( css ) ;
65
64
extractExports ( css ) ;
65
+ css . tokens = exportTokens ;
66
66
}
67
67
} ) ;
You can’t perform that action at this time.
0 commit comments