Preheat oven to 350 degrees F. Grease your 9"x13" baking dish or grease two 9" round cake pans and line with parchment rounds.
Using a large bowl and a wooden spoon/whisk, mix together sugar, oil, eggs, vanilla extract, and buttermilk. Then stir in carrots, coconut, and pineapple.
In a small bowl, combine flour, baking soda, salt, and cinnamon. Using a wooden spoon, gently fold the dry mix into the wet mix.
Stir in chopped nuts (or raisins). Pour mixture into your prepared 9"x13" pan or two 9" round cake pans.
Bake for 40 minutes. Stick a toothpick in the centre, if it's still jiggly and/or toothpick doesn't come out clean, cover pan(s) with a sheet of aluminum foil and continue baking until toothpick comes out clean. Depending on the type of pan used, baking can take over 60 minutes.
Once finished baking, remove from oven and let cake cool completely before topping it with the cream cheese frosting.
Sprinkle coconut flakes evenly onto a baking sheet and bake for 3-5 minutes at 350 degrees F. Watch it continuously as it bakes quickly and can burn easily. When most of the flakes are golden brown, remove from the oven and place baking sheet on rack to cool.
Using the paddle attachment on a stand-mixer or using a handheld mixer, combine butter and cream cheese on medium-high speed until fluffy (at least 2 minutes).
Add vanilla extract, powdered sugar, and salt. Blend on medium speed until combined and creamy.
Pipe or smooth frosting onto completely cooled cake, sprinkle with optional toasted coconut and enjoy!
If you're just planning on baking a 9"x13" cake and only frosting the top, you could get away with cutting the frosting recipe in half. (Unless you love alot of frosting!) A full frosting recipe is great for a two layer 9" round cake.
Store frosted carrot cake covered in the refrigerator for 5-7 days, and then freeze any leftovers.
This cake freezes really well, even while frosted! Slice cake into desired portions and place in sealed tupperware container in the freezer. When wanting to eat, just remove one, and let it thaw to room temp for about an hour.