Preheat Oven and Prepare Pan: Begin by setting your oven to 350°F (175°C) to ensure it's ready for baking. Place cupcake liners in your baking tin to prevent sticking and facilitate easy removal of the cupcakes after baking.
Mixing Dry Ingredients: In a mixing bowl, sift together the flour, baking powder, and salt until well combined.
Creaming Butter and Sugar: Using a separate bowl, cream the butter and sugar until the mixture is light and fluffy.
Incorporating Eggs: Add the eggs one at a time to the mixture, ensuring each one is thoroughly beaten in before adding the next. Mix in the vanilla extract.
Combine Wet and Dry Ingredients: Alternately add the dry ingredients and coconut milk to the butter mixture, starting and ending with the dry ingredients. Stir until just combined.
Add Pandan Juice: Mix in the pandan juice and a few drops of green food coloring (if using) until the color is uniform.
Fill and Bake: Fill the cupcake liners about two-thirds full. Bake the cupcakes for 18-20 minutes, checking for doneness with a toothpick inserted into the center. If it comes out clean, they are ready.
Cooling: Let the cupcakes rest in the tin for about 5 minutes, then transfer them to a wire rack to cool completely.