If you have gaps, the windows are the wrong size. And NEVER use expanding foam on door or windows, it can cause the frames to bow, and possibly jam things from working.
Replacement windows should be about 1/4 smaller than the opening. With this dimension, there will be no gap on the outside, and a small gap around the perimeter that gets insulated with NON expanding foam such a DAP Foam. That gap is also small enough to be covered by the original stop molding.
Replacement windows should be about 1/4 smaller than the opening. With this dimension, there will be no gap on the outside, and a small gap around the perimeter that gets insulated with NON expanding foam such a DAP Foam. That gap is also small enough to be covered by the original stop molding.