1- const sass = require ( 'node-sass' )
2- const path = require ( 'path' )
1+ const sass = require ( 'node-sass' ) ;
2+ const path = require ( 'path' ) ;
33
44module . exports = ( css , settings ) => {
55 const cssWithPlaceholders = css
@@ -12,14 +12,23 @@ module.exports = (css, settings) => {
1212
1313 // Add the directory containing the current file to includePaths to enable relative
1414 // imports, only works when the filename is provided
15- const includePaths = settings . sassOptions && settings . sassOptions . includePaths || [ ]
15+ const includePaths = settings . sassOptions && settings . sassOptions . includePaths || [ ] ;
16+
1617 if ( settings . babel && settings . babel . filename ) {
1718 includePaths . push ( path . dirname ( settings . babel . filename ) ) ;
1819 }
1920
20- const preprocessed = sass . renderSync ( Object . assign ( {
21- data : cssWithPlaceholders
22- } , settings . sassOptions , { includePaths } ) ) . css . toString ( )
21+ // Prepend option data to cssWithPlaceholders
22+ const optionData = settings . sassOptions && settings . sassOptions . data || "" ;
23+ const data = optionData + "\n" + cssWithPlaceholders ;
24+
25+ const preprocessed = sass . renderSync (
26+ Object . assign (
27+ { } ,
28+ settings . sassOptions ,
29+ { data } ,
30+ { includePaths }
31+ ) ) . css . toString ( )
2332
2433 return preprocessed
2534 . replace ( / s t y l e d - j s x - p l a c e h o l d e r - ( \d + ) - ( \w * \s * [ ) , ; ! { ] ) / g, ( _ , id , p1 ) =>
0 commit comments