File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,28 @@ function init({ typescript: ts }: { typescript: typeof tsModule }) {
31
31
const options : Options = info . config . options || { } ;
32
32
logger . log ( `options: ${ JSON . stringify ( options ) } ` ) ;
33
33
34
- // Set environment variables, resolves #49 .
34
+ // Load environment variables like SASS_PATH .
35
35
// TODO: Add tests for this option.
36
+ const dotenvOptions = options . dotenvOptions || { } ;
37
+ if ( dotenvOptions ) {
38
+ dotenvOptions . path = path . resolve (
39
+ directory ,
40
+ dotenvOptions . path || '.env' ,
41
+ ) ;
42
+ }
36
43
dotenv . config ( options . dotenvOptions ) ;
37
44
45
+ // Normalise SASS_PATH array to absolute paths.
46
+ if ( process . env . SASS_PATH ) {
47
+ process . env . SASS_PATH = process . env . SASS_PATH . split ( path . delimiter )
48
+ . map ( ( sassPath ) =>
49
+ path . isAbsolute ( sassPath )
50
+ ? sassPath
51
+ : path . resolve ( directory , sassPath ) ,
52
+ )
53
+ . join ( path . delimiter ) ;
54
+ }
55
+
38
56
// Add postCSS config if enabled.
39
57
const postCssOptions = options . postCssOptions || { } ;
40
58
You can’t perform that action at this time.
0 commit comments