Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit fdc890f

Browse files
committed
Fix handling of build flag and empty env
`./scripts/build.js --libsass_ext=auto` resets `libsass_*` whereas it should not. This patch drops the env vars that have not been set at all.
1 parent 2513e6a commit fdc890f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/build.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,18 @@ function afterBuild(options) {
5656
*/
5757

5858
function build(options) {
59-
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat(
60-
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
61-
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
62-
})).concat(options.args);
59+
var libargs = ['ext', 'cflags', 'ldflags', 'library'].reduce(function(prev, cur) {
60+
var arg = `libsass_${cur}`;
61+
var env = process.env[arg.toUpperCase()];
62+
if (env) {
63+
return prev.push(['--', arg, '=', env].join(''));
64+
} else {
65+
return prev;
66+
}
67+
}, []);
68+
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose']
69+
.concat(libargs)
70+
.concat(options.args);
6371

6472
console.log('Building:', [process.execPath].concat(args).join(' '));
6573

0 commit comments

Comments
 (0)