Generally, if you can win a clean minor piece in the opening, 3 pt advantage, then take it. Obviously, check for tactics first. At intermediate levels such a material advantage is often decisive between equally matched players. Development is important in the opening but so is a 3 pt advantage. If you find you are being punished for it then maybe the game went wrong somewhere else or you missed a tactic.
winning material in the opening
Just to add. The key thing is start exploiting your advantage straight away. Seek trades so as to amplify your material advantage. Get the queens off to limit their counterplay. Create multiple threats to stretch your opponents resources.
If a minor piece is there to be won, and it won't cost you dearly (For example a piece sacrifice to gain a huge initiative), you should take it. However, you mustn't take your eye off the ball: Do whatever you can to get developed, even if it costs a pawn to do so. This way, your extra piece advantage can be put to work immediately.
Gambits are a little tricky: Gambits like the Danish and Evans Gambit give great practical chances. Here, you should not grab pawns for the sake of it, and you should look to find ways to sacrifice the pawn you have won back in order to develop quickly, which often leads to a much simpler game. For example:
Sometimes I take these opportunities but then struggle in the middle game when the opposition has a positional (but not material) advantage due to better development.
Are there any general principles for when you should take opportunities to win material in the opening phase and when you should pass these opportunities up?
Cheers