Such as Comma
The phrase such as only requires a comma in front of it if it’s part of a non-restrictive clause.
There are many different types of coniferous trees, such as pine and spruce.
The comma in this sentence isn’t necessary, as it’s only giving examples.
The Grade 5 class studied ancient cultures such as Greece and Rome.
Fresh fruit provides many nutrients such as vitamin C.
Neither of the above sentences requires a comma.
The Grade 5 class studied ancient cultures, such as Greece and Rome, before they studied different forms of government.
Fresh fruit provides many nutrients, such as vitamin C, and tastes good too.
These two sentences require the commas because such as is part of the non-restrictive clauses.