Prepare the Cake Batter:
- Preheat your oven to 350°F (175°C). Grease a 9×13-inch baking pan and line with parchment paper for easy removal.
- In a large bowl, whisk together the flour, baking powder, baking soda, salt, cinnamon, nutmeg, ginger, and allspice.
- In a separate bowl, combine vegetable oil, granulated sugar, and brown sugar. Mix until well combined.
- Add the eggs one at a time, beating well after each addition. Stir in the vanilla extract.
- Fold in the grated carrots, crushed pineapple, nuts, and coconut (if using).
- Pour the batter into the prepared pan, spreading it evenly.
- Bake for 40-45 minutes or until a toothpick inserted into the center comes out clean.
- Allow the cake to cool in the pan for about 10 minutes before transferring to a wire rack to cool completely.
Prepare the Cream Cheese Frosting:
- Beat softened cream cheese and butter in a medium bowl until smooth and creamy.
- Gradually add powdered sugar, one cup at a time, beating well after each addition.
- Stir in vanilla extract. If the frosting is too thick, add milk a tablespoon at a time until you reach a spreadable consistency.
Frost the Cake:
- Once the cake has cooled completely, spread the cream cheese frosting evenly over the top.
- Cut into squares and serve.