File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " typescript-plugin-css-modules" ,
3- "version" : " 2.0.0 " ,
3+ "version" : " 2.0.1 " ,
44 "main" : " lib/index.js" ,
55 "author" : " Brody McKee <mrmckeb@hotmail.com>" ,
66 "license" : " MIT" ,
Original file line number Diff line number Diff line change @@ -31,10 +31,28 @@ function init({ typescript: ts }: { typescript: typeof tsModule }) {
3131 const options : Options = info . config . options || { } ;
3232 logger . log ( `options: ${ JSON . stringify ( options ) } ` ) ;
3333
34- // Set environment variables, resolves #49 .
34+ // Load environment variables like SASS_PATH .
3535 // 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+ }
3643 dotenv . config ( options . dotenvOptions ) ;
3744
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+
3856 // Add postCSS config if enabled.
3957 const postCssOptions = options . postCssOptions || { } ;
4058
You can’t perform that action at this time.
0 commit comments