Preheat the oven to 350°F (175°C) and line a muffin tin with cupcake liners.
Mix dry ingredients in a medium bowl.
Beat butter and sugar until fluffy, then add eggs and vanilla.
Gradually add pineapple juice and coconut milk. Mix until smooth.
Gradually add dry ingredients and fold in crushed pineapple.
Spoon batter into cupcake liners, filling 2/3 full.
Bake for 18-20 minutes, then cool completely.
For frosting, beat butter, add powdered sugar, and coconut milk. Add rum (if using) and frost the cupcakes. Garnish with shredded coconut.