That doesn't work, gyp (or rather the shell the command is passed to) complains that '&&' is not a valid identifier.
Peeking into the generated makefile, the command has been expanded to this, which explains the shell error:
export "FOO=BAR" "&&" do-something-else --option
The quotes have been left around the variable assignment and the &&. It's not clear why. I've tried many variations to stop this from happening to no avail. Anything that contains = or & ends up with quotes left around it, which in most cases renders the command syntax invalid.
( 9 months ago )
The reason this happens is that Gyp considers everything after the first word to be an argument to the command given in the first word so it quotes these and other special characters to prevent the shell interpreting them. I do not think there is any way to prevent it which, as you discovered, makes creating a custom command using a pipeline of shell commands well nigh impossible.