@@ -7,19 +7,19 @@ const generate = (file) => `
7
7
output { contents: inspect($${ path . basename ( file , '.json' ) } ) }
8
8
` ;
9
9
10
- const compile = function ( data ) {
10
+ const compile = function ( data , options = { } ) {
11
11
return new Promise ( ( yeah , nah ) => {
12
12
return sass . render (
13
- { data, importer } ,
13
+ Object . assign ( { data, importer } , options ) ,
14
14
( err , results ) => err ? nah ( err ) : yeah ( results . css . toString ( ) ) ,
15
15
) ;
16
16
} ) ;
17
17
}
18
18
19
- const compileSync = function ( data ) {
19
+ const compileSync = function ( data , options = { } ) {
20
20
return new Promise ( ( yeah , nah ) => {
21
21
try {
22
- const results = sass . renderSync ( { data, importer } ) ;
22
+ const results = sass . renderSync ( Object . assign ( { data, importer } , options ) ) ;
23
23
yeah ( results . css . toString ( ) ) ;
24
24
} catch ( err ) {
25
25
nah ( err ) ;
@@ -42,6 +42,10 @@ describe('json-importer', () => {
42
42
func ( generate ( 'tests/fixtures/list.json' ) )
43
43
. then ( result => expect ( result ) . toMatchSnapshot ( ) )
44
44
) ) ;
45
+ it ( 'should resolve json files in includePaths' , ( ) => (
46
+ func ( generate ( 'fixtures/flat.json' ) , { includePaths : [ 'tests' ] } )
47
+ . then ( result => expect ( result ) . toMatchSnapshot ( ) )
48
+ ) ) ;
45
49
} ) ;
46
50
} ) ;
47
51
} ) ;
0 commit comments