@@ -7,19 +7,19 @@ const generate = (file) => `
77output { contents: inspect($${ path . basename ( file , '.json' ) } ) }
88` ;
99
10- const compile = function ( data ) {
10+ const compile = function ( data , options = { } ) {
1111 return new Promise ( ( yeah , nah ) => {
1212 return sass . render (
13- { data, importer } ,
13+ Object . assign ( { data, importer } , options ) ,
1414 ( err , results ) => err ? nah ( err ) : yeah ( results . css . toString ( ) ) ,
1515 ) ;
1616 } ) ;
1717}
1818
19- const compileSync = function ( data ) {
19+ const compileSync = function ( data , options = { } ) {
2020 return new Promise ( ( yeah , nah ) => {
2121 try {
22- const results = sass . renderSync ( { data, importer } ) ;
22+ const results = sass . renderSync ( Object . assign ( { data, importer } , options ) ) ;
2323 yeah ( results . css . toString ( ) ) ;
2424 } catch ( err ) {
2525 nah ( err ) ;
@@ -42,6 +42,10 @@ describe('json-importer', () => {
4242 func ( generate ( 'tests/fixtures/list.json' ) )
4343 . then ( result => expect ( result ) . toMatchSnapshot ( ) )
4444 ) ) ;
45+ it ( 'should resolve json files in includePaths' , ( ) => (
46+ func ( generate ( 'fixtures/flat.json' ) , { includePaths : [ 'tests' ] } )
47+ . then ( result => expect ( result ) . toMatchSnapshot ( ) )
48+ ) ) ;
4549 } ) ;
4650 } ) ;
4751} ) ;
0 commit comments