File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ export default function setup(opts = {}) {
45
45
// https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts
46
46
lazyResultOpts = pick ( opts , [ 'to' ] ) ;
47
47
48
+ const extraExtensions = get ( 'extensions' , null , 'array' , opts ) ;
49
+ if ( extraExtensions ) {
50
+ extraExtensions . forEach ( ( extension ) => {
51
+ hook ( filename => fetch ( filename , filename ) , extension ) ;
52
+ } ) ;
53
+ }
54
+
48
55
const customPlugins = get ( 'use' , [ 'u' ] , 'array' , opts ) ;
49
56
if ( customPlugins ) {
50
57
return void ( plugins = customPlugins ) ;
@@ -66,13 +73,6 @@ export default function setup(opts = {}) {
66
73
plugins . push ( generateScopedName
67
74
? new Scope ( { generateScopedName : opts . generateScopedName } )
68
75
: Scope ) ;
69
-
70
- const extraExtensions = get ( 'extensions' , null , 'array' , opts ) ;
71
- if ( extraExtensions ) {
72
- extraExtensions . forEach ( ( extension ) => {
73
- hook ( filename => fetch ( filename , filename ) , extension ) ;
74
- } ) ;
75
- }
76
76
}
77
77
78
78
/**
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { equal } from 'assert';
2
2
import { readFileSync } from 'fs' ;
3
3
import { resolve } from 'path' ;
4
4
import { extend } from 'lodash' ;
5
+ import ExtractImports from 'postcss-modules-extract-imports' ;
6
+ import LocalByDefault from 'postcss-modules-local-by-default' ;
7
+ import Scope from 'postcss-modules-scope' ;
5
8
import FileSystemLoader from 'css-modules-loader-core/lib/file-system-loader' ;
6
9
import hook from '../src' ;
7
10
@@ -219,10 +222,14 @@ describe('common-test-cases', () => {
219
222
} ) ;
220
223
} ) ;
221
224
222
- describe ( 'extra extension' , ( ) => {
225
+ describe ( 'extra extension with custom plugins ' , ( ) => {
223
226
before ( ( ) => {
224
227
expectedTokens = JSON . parse ( readFileSync ( resolve ( 'test/test-cases/extra-extension/expected.json' ) , 'utf8' ) ) ;
225
- hook ( { extensions : [ '.scss' ] } )
228
+ hook ( { extensions : [ '.scss' ] , use : [
229
+ ExtractImports ,
230
+ LocalByDefault ,
231
+ Scope ,
232
+ ] } ) ;
226
233
} ) ;
227
234
228
235
it ( 'require-hook' , ( ) => {
Original file line number Diff line number Diff line change 1
- $color : orange ;
1
+ $color : #c0ffee ;
2
2
3
3
.localName {
4
4
color : $color ;
You can’t perform that action at this time.
0 commit comments