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 = {}) {
4545 // https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts
4646 lazyResultOpts = pick ( opts , [ 'to' ] ) ;
4747
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+
4855 const customPlugins = get ( 'use' , [ 'u' ] , 'array' , opts ) ;
4956 if ( customPlugins ) {
5057 return void ( plugins = customPlugins ) ;
@@ -66,13 +73,6 @@ export default function setup(opts = {}) {
6673 plugins . push ( generateScopedName
6774 ? new Scope ( { generateScopedName : opts . generateScopedName } )
6875 : 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- }
7676}
7777
7878/**
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { equal } from 'assert';
22import { readFileSync } from 'fs' ;
33import { resolve } from 'path' ;
44import { 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' ;
58import FileSystemLoader from 'css-modules-loader-core/lib/file-system-loader' ;
69import hook from '../src' ;
710
@@ -219,10 +222,14 @@ describe('common-test-cases', () => {
219222 } ) ;
220223 } ) ;
221224
222- describe ( 'extra extension' , ( ) => {
225+ describe ( 'extra extension with custom plugins ' , ( ) => {
223226 before ( ( ) => {
224227 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+ ] } ) ;
226233 } ) ;
227234
228235 it ( 'require-hook' , ( ) => {
Original file line number Diff line number Diff line change 1- $color : orange ;
1+ $color : #c0ffee ;
22
33.localName {
44 color : $color ;
You can’t perform that action at this time.
0 commit comments