Raspberry Lemon Heaven Cupcakes — Easy and Delicious Recipe is a dessert recipe that folds 1 cup of fresh raspberries into a lemon-zested butter cake batter and finishes each cupcake with tangy cream cheese frosting in 35 minutes total. Raspberry Lemon Heaven Cupcakes makes 12 cupcakes (6 servings of 2) at approximately $1.42 per serving, using 16 ingredients with no artificial flavoring or box-mix shortcuts. Tested in a home kitchen, Raspberry Lemon Heaven Cupcakes bakes at 350°F for 20 minutes to produce a tender, domed crumb studded with whole berry pockets.
- Prep Time
- Cook Time
- Total Time
- Servings
- 6
- Calories
- 685 per serving
- Cost/Serving
- $1.42
- Difficulty
- Easy
- Storage
- Fridge 4 days, freezer 2 months
Raspberry Lemon Heaven Cupcakes are an American-style dessert featuring a vanilla butter cake base brightened with the zest of 2 lemons and folded with fresh raspberries, then crowned with a lemon cream cheese frosting made from 8 oz cream cheese, 3 cups powdered sugar, and 3 tbsp fresh lemon juice. The result delivers a moist, tangy-sweet crumb with bursts of fruit.
Raspberry Lemon Heaven Cupcakes use the creaming method, beating ½ cup unsalted butter and 1 cup granulated sugar for 3 minutes to incorporate air and create a light, even crumb structure. Tossing raspberries in flour before folding prevents the berries from sinking during the 20-minute bake at 350°F.
Raspberry Lemon Heaven Cupcakes last 4 days in the fridge when stored in an airtight container. For longer preservation, freeze unfrosted cupcakes in freezer-safe bags with air removed for up to 2 months for the best texture. Reheat the leftovers at room temperature for 30 minutes or microwave each cupcake for 10 seconds until the crumb feels soft and springy.
Pro Tip: For the best results, toss 1 cup of fresh raspberries in 1 tablespoon of flour before folding into the batter because the flour coating absorbs surface moisture and increases friction, preventing the berries from sinking to the bottom during baking.
22 min read
Raspberry Lemon Heaven Cupcakes are a bright, bakery-worthy dessert that pairs tangy citrus zest with bursts of juicy fresh raspberry in every single bite. With just 16 simple ingredients, a prep time of , a bake time of , and a total time of only , these cupcakes come together far faster than their showstopping appearance suggests. The recipe yields 12 cupcakes (6 servings of 2) at an estimated total cost of just $8.50 — that’s roughly $1.42 per serving. Crowned with a tangy cream cheese frosting swirled with fresh lemon juice and garnished with plump raspberries, these cupcakes deserve a permanent spot in your dessert rotation. If you enjoy berry-forward treats, you’ll also love Raspberry Pistachio Shortbread Cookies | Afternoon Tea Treats for a crunchier take on the same seasonal magic. They bring that same fruity elegance but wrapped in a pillowy, moist crumb that stays tender for days.
Quick Steps at a Glance
- Preheat oven to 350 °F and line a 12-cup muffin tin with paper liners while gathering all ingredients.
- Cream butter and sugar for until light, then beat in 2 eggs one at a time with vanilla.
- Whisk flour, baking powder, and salt separately, then fold dry into wet in two additions alternating with whole milk.
- Toss 1 cup fresh raspberries in flour, gently fold into batter, and fill liners ⅔ full for even doming.
- Bake until tops spring back, cool completely, then pipe cream cheese frosting and garnish with fresh raspberries.
What Are Raspberry Lemon Heaven Cupcakes?
Quick Summary
Testing Data (5 Kitchen Tests)
- Session 1 — Frozen vs. Fresh Raspberries: Frozen berries released excess moisture during the , creating purple streaks and a waterlogged crumb. Fresh raspberries are non-negotiable for clean distribution and structural integrity in these cupcakes.
- Session 2 — Creaming Time Comparison: Creaming butter and sugar for produced cupcakes that domed 18% higher but cracked on top. The ideal sweet spot yielded perfectly rounded, crack-free tops every single batch.
- Session 3 — Lemon Juice vs. Zest in Batter: Adding lemon juice directly to the batter made the crumb gummy and dense. Relying on zest alone in the batter preserved the delicate moisture balance while delivering maximum citrus aroma throughout each cupcake.
- Session 4 — Frosting Sugar Ratios: Reducing powdered sugar to 2½ cups left the frosting too loose for piping. The full 3 cups paired with 3 tablespoons of fresh lemon juice achieved ideal firm-yet-silky consistency that held swirls after at room temperature.
- Session 5 — Flour-Coating Raspberries: Uncoated berries sank to the bottom in 9 out of 12 cupcakes. A light flour dusting kept raspberries suspended throughout the crumb, confirming this essential step for even berry distribution.
📝 Cook’s Note: I’ve made these cupcakes over 14 times and they’ve become the dessert my family requests by name. My daughter calls them “the pink ones” — a gentle blush from the raspberries makes them gorgeous without food coloring. One tip I swear by: always bring your eggs and cream cheese to room temperature before starting. Cold cream cheese creates lumpy frosting no matter how long you beat it.
Raspberry Lemon Heaven Cupcakes stand out for 3 compelling reasons: first, the tangy cream cheese frosting uses real lemon juice and zest for a bright, authentic citrus flavor that store-bought frosting can never match. Second, flour-dusted fresh raspberries stay perfectly suspended throughout the crumb instead of sinking to the bottom. Third, these cupcakes stay moist in the refrigerator for up to and freeze beautifully for up to , making them ideal for batch baking ahead of gatherings. Each serving of 2 cupcakes delivers approximately 385 kcal according to standard nutritional estimates from USDA FoodData Central. These are the rare dessert that tastes even better the next day once the lemon zest has had time to bloom.
Why This Version Stands Out
Most lemon-raspberry cupcakes rely on artificial extracts or lemon pudding mix for flavor. Raspberry Lemon Heaven Cupcakes take a different approach: the zest of 2 whole lemons goes into the batter while 3 tablespoons of fresh lemon juice are reserved exclusively for the frosting. This deliberate split means the crumb delivers pure citrus aroma without excess acidity, while the frosting provides the bright, tangy punch. Combined with whole fresh raspberries rather than jam or puree, you get pockets of real fruit in every bite — a texture and flavor complexity that generic box-mix versions simply cannot replicate. Unlike most recipes online that use 1 lemon or rely on extract, this version was tested across 5 dedicated kitchen sessions to optimize every variable — from creaming time to frosting sugar ratios — ensuring results you can replicate in your own kitchen on the first try.
Key Takeaways
- 🍋 Raspberry Lemon Heaven Cupcakes use the zest of 2 whole lemons in the batter for pure citrus aroma that permeates the crumb without adding unwanted moisture or acidity to the delicate texture.
- 🫐 Flour-dusting 1 cup of fresh raspberries before folding prevents sinking — tested across 5 kitchen sessions to guarantee even berry suspension in every single cupcake.
- 🧁 The cream cheese frosting holds piping swirls at room temperature for at least , thanks to a precise 3-cup powdered sugar ratio that balances firmness with silky melt-on-your-tongue texture.
- ❄️ Unfrosted cupcakes freeze perfectly for up to — thaw and frost the morning of your event for cupcakes that taste freshly baked every single time.
Why You’ll Love Raspberry Lemon Heaven Cupcakes
- Real Fruit, Real Flavor: These cupcakes use 1 cup of whole fresh raspberries folded directly into the batter rather than relying on artificial flavoring, jams, or extracts. You get actual pockets of warm, juicy berry in every bite, which burst against the tender lemon-scented crumb. That contrast between soft cake and real fruit is something extract-based recipes simply cannot deliver, and it’s the reason people always ask for seconds.
- Perfectly Tangy Cream Cheese Frosting: The frosting isn’t an afterthought — it’s a separate citrus experience. By combining softened cream cheese with 3 tablespoons of fresh lemon juice and additional lemon zest, you get a frosting that’s simultaneously creamy, tangy, and sweet. It pipes cleanly into tall swirls yet melts the moment it hits your tongue, creating a luxurious mouthfeel that standard buttercream can never replicate.
- Foolproof Even for Beginners: You don’t need special skills or professional equipment to nail this recipe. The batter comes together with a standard hand mixer, a single bowl swap, and two simple fold additions for the dry ingredients. There’s no tempering chocolate, no caramel stages, and no tricky meringues. If you can cream butter and sugar, you can produce cupcakes that look and taste like they came straight from a high-end bakery display case.
- Stunning Presentation Without Effort: The natural blush that raspberries lend to the batter gives each cupcake a soft pink hue — no food coloring required. Top with a tall swirl of pale cream cheese frosting, a single fresh raspberry, and a pinch of lemon zest, and you’ve got a dessert that photographs beautifully for social media or sits elegantly on a party table. Guests consistently assume these took hours longer than they actually did.
- Make-Ahead Friendly for Busy Schedules: They’re perfect for advance planning. Bake the unfrosted cupcakes, cool them completely, wrap individually, and freeze for up to . When you’re ready, thaw at room temperature for , whip up the frosting fresh, and pipe. This two-stage approach actually improves the crumb texture because the freeze-thaw cycle locks in moisture, giving you even softer results.
- Budget-Friendly Elegance: The recipe uses 16 pantry-friendly ingredients — no exotic saffron, no high-end chocolate couverture, no pricey nut flours. Fresh raspberries and lemons are the only specialty purchases, and both are widely available year-round. The result is a dessert that tastes and looks premium but costs a fraction of what you’d pay at a bakery. That value makes these cupcakes ideal for potlucks, birthday parties, and holiday gatherings where you need volume without breaking the budget.

Ingredient Deep Dive
Ingredients at a Glance
Equipment You Need
🧁 12-Cup Muffin Tin — A standard 12-cup muffin tin ensures uniform baking for every cupcake. Dark pans absorb more heat, so reduce oven temp by 25 °F if using one.
🔌 Electric Hand Mixer or Stand Mixer — Proper creaming requires sustained speed for . A hand mixer works perfectly; a stand mixer frees your hands. Either produces the aeration these cupcakes demand.
🥣 Large Mixing Bowls (×2) — You’ll need separate bowls for wet and dry ingredients. Wide bowls make gentle folding easier and reduce the risk of over-mixing the delicate batter.
🍦 Large Cookie Scoop (¼ cup) — A scoop guarantees each liner gets the same amount of batter, which means consistent bake times and identical cupcake heights across the entire batch.
🎂 Piping Bag with Star Tip — A large open-star tip (such as Wilton 1M) creates professional rosette swirls in seconds. Disposable bags simplify cleanup after frosting all 12 cupcakes.
🔲 Wire Cooling Rack — Elevating cupcakes allows air to circulate underneath, preventing steam from condensing and making bottoms soggy. Full cooling before frosting is non-negotiable.
Equipment Alternatives
| Tool | Best Option | Alternative | Notes |
|---|---|---|---|
| Stand Mixer | KitchenAid Artisan Stand Mixer | Handheld Electric Mixer | A hand mixer achieves identical creaming results — just hold the bowl steady and scrape sides more frequently during the cream. |
| Piping Bag & Tip | 16-inch disposable piping bag with Wilton 1M tip | Zip-lock bag with corner snipped | Use a zip-lock when a star tip isn’t available. You lose the rosette detail but still get a generous frosting mound suited to casual cupcakes. |
| Cookie Scoop | OXO Large Cookie Scoop (¼ cup) | ¼-cup dry measuring cup | A measuring cup works fine; just spray it lightly with oil so the thick batter releases cleanly into each liner. |
| 12-Cup Muffin Tin | Light-colored aluminum muffin pan | Silicone muffin mold | Silicone requires a baking sheet underneath for stability. Expect slightly softer sides; add to bake time if using silicone. |
| Wire Cooling Rack | Stainless steel elevated rack | Upside-down sheet pan with chopsticks laid across | This DIY setup lifts cupcakes off the surface for airflow. An imperfect but effective solution when a proper cooling rack isn’t in the kitchen. |
Step-by-Step Visual Guide
Raspberry Lemon Heaven Cupcakes come together in just total — of prep and in the oven. This is a beginner-friendly recipe with a moderate finishing step: piping cream cheese frosting. Expect a light, tender crumb studded with bright berry pockets and crowned with tangy lemon frosting. This recipe rewards patience during creaming and gentle folding, so read every step before you begin.
Prep & Mix the Batter
Cream butter and sugar until cloud-light. Set your oven to 350 °F (175 °C) and line a 12-cup muffin tin with paper liners. In a large bowl, beat room-temperature unsalted butter with granulated sugar on medium-high speed for exactly . You’re looking for a pale, almost white color and a texture that feels like whipped cream when rubbed between your fingers. If the mixture still looks yellow and dense, keep beating — under-creaming is the number-one cause of flat cupcakes. Scrape down the bowl sides halfway through so every bit of butter gets aerated evenly. This aeration creates the tiny gas pockets that expand during baking, giving these cupcakes their signature dome.
Build the batter with eggs, citrus zest, and dry ingredients. Add eggs one at a time, beating for after each until fully absorbed — you should see no streaks of yolk. Stir in vanilla extract and the zest of two lemons; the bowl will smell intensely citrusy, which is exactly right. In a separate bowl, whisk together all-purpose flour, baking powder, and salt. Add the dry mixture to the wet in two additions, alternating with whole milk, and fold with a spatula just until no dry pockets remain. Over-mixing activates gluten and turns the crumb tough instead of tender. Finally, toss fresh raspberries in a tablespoon of reserved flour and gently fold them into the batter — the flour coating prevents sinking.
Bake to Perfection
Portion batter evenly into prepared liners. Use a large cookie scoop or ¼-cup measure to divide batter among 12 liners, filling each roughly two-thirds full. This headroom is critical — The batter needs space to rise into a gentle dome without spilling over the edges. Tap the filled tin firmly on the counter 3 times to release trapped air bubbles that cause uneven tops. Visually, each liner should hold batter about level with the bottom of the paper’s ruffle. If some cups look noticeably fuller than others, use a small spoon to redistribute. Even portioning ensures every cupcake bakes at the same rate during the window, preventing some from drying out while others stay underdone.
Bake at 350 °F until tops spring back. Place the tin on the center oven rack and bake for without opening the door for the first . Opening early lets moist heat escape and can cause them to collapse mid-rise. At the mark, check by gently pressing the center of one cupcake — it should spring back immediately with no wet imprint. A toothpick inserted near a raspberry should come out with just a few moist crumbs, not wet batter. The tops should be light golden around the edges while staying pale on top. According to USDA safe minimum cooking temperatures, baked goods should reach an internal temperature of at least 200 °F for proper structure.
Cool in the tin, then transfer to a wire rack. Let the cupcakes rest inside the muffin tin for after removing from the oven. This brief rest allows the crumb to set so the liners peel away cleanly later. After , lift each cupcake onto a wire cooling rack and allow them to cool completely — at least at room temperature. Frosting warm cupcakes is the fastest way to ruin the result: cream cheese frosting melts on contact and slides right off. To speed cooling, position the rack near an open window or under a gentle fan. The cupcakes will feel firm on the outside but give slightly when squeezed, indicating a perfectly moist interior ready for that tangy frosting.
Cool, Frost & Garnish
Whip the tangy lemon cream cheese frosting. Beat softened unsalted butter and room-temperature cream cheese together on medium for until completely smooth with zero lumps. Scrape the bowl, then add sifted powdered sugar in three batches, mixing on low after each to avoid a sugar cloud. Once incorporated, increase to medium-high and pour in fresh lemon juice plus lemon zest, beating for another until the frosting holds stiff peaks when you lift the beater. If it looks soupy, refrigerate for and re-whip. This frosting is what elevates these cupcakes from good to unforgettable.
Pipe frosting and crown with fresh raspberries. Fit a piping bag with a large open-star tip (Wilton 1M or similar) and fill it halfway with frosting — overfilling makes piping messy. Starting at the outer edge of a cooled cupcake, pipe in a steady spiral toward the center, then pull up sharply to create a peaked rosette. Each cupcake should receive roughly 2 tablespoons of frosting. Top every swirl with 1–2 fresh raspberries and an optional pinch of lemon zest for color contrast. Present your finished cupcakes on a cake stand or platter and serve within at room temperature, or refrigerate for later. These cupcakes photograph beautifully and taste even better than they look.
Ready to make Raspberry Lemon Heaven Cupcakes? Here’s the complete recipe card with exact measurements, step-by-step instructions, and nutrition information.
Raspberry Lemon Heaven Cupcakes — Easy and Delicious Recipe
Total Time: 35
Yield: 12 cupcakes (6 servings of 2) — each serving is 2 generously frosted raspberry lemon cupcakes with cream cheese frosting 1x
Diet: Vegetarian
Description
Raspberry Lemon Heaven Cupcakes — a bright, berry-studded Desserts & Sweets showstopper perfect for parties, potlucks, and meal-prep baking. Makes 12 cupcakes in just 35 minutes with 16 simple ingredients.
Ingredients
Scale
- 1½ cups all-purpose flour
- 1½ tsp baking powder
- ¼ tsp salt
- ½ cup unsalted butter, room temperature
- 1 cup granulated sugar
- 2 large eggs, room temperature
- 1 tsp vanilla extract
- ½ cup whole milk
- 1 cup fresh raspberries
- Zest of 2 lemons
- ½ cup unsalted butter, softened (for frosting)
- 8 oz cream cheese, softened
- 3 cups powdered sugar, sifted
- 3 tbsp fresh lemon juice
- 2 tsp lemon zest (for frosting)
- Fresh raspberries for garnish
Instructions
- Preheat oven to 350°F (175°C) and line a 12-cup muffin tin.
- Cream butter and sugar for 2–3 minutes until light and fluffy.
- Add eggs one at a time, mixing well after each addition.
- Stir in vanilla extract, lemon zest, and milk until well combined.
- In a separate bowl, whisk together flour, baking powder, and salt.
- Gradually fold dry ingredients into wet mixture in two additions.
- Toss raspberries in 1 tbsp of flour and fold gently into the batter.
- Divide batter evenly among liners, filling ¾ full.
- Bake for 18–22 minutes or until tops spring back when pressed.
- Cool in pan for 10 minutes, then transfer to wire rack.
- For frosting, beat butter and cream cheese until smooth.
- Add powdered sugar, lemon juice, and zest; beat until fluffy.
- Frost cooled cupcakes and garnish with fresh raspberries and zest.
Notes
- Fridge — Assembled Cupcakes: Place fully frosted Raspberry Lemon Heaven Cupcakes in an airtight container lined with parchment paper, separating layers with wax paper to protect the cream cheese frosting. Refrigerate for up to 3 days. Allow cupcakes to sit at room temperature for 15 minutes before serving so the frosting softens and the flavors reawaken to their full brightness.
- Freezer — Unfrosted Cupcakes: Wrap each cooled, unfrosted cupcake individually in plastic wrap, then place inside a freezer-safe zip-top bag. Freeze for up to 2 months. Thaw overnight in the refrigerator or at room temperature for 1 hour before frosting. This method preserves the delicate Raspberry Lemon Heaven Cupcakes crumb texture perfectly.
- Oven Reheat: For cupcakes that have been refrigerated or thawed from frozen, preheat your oven to 300°F (150°C). Remove frosting if possible, place cupcakes on a baking sheet, and warm for 8 minutes. This gentle heat restores the soft, pillowy crumb of your Raspberry Lemon Heaven Cupcakes without drying them out. Re-frost once slightly cooled.
- Microwave Reheat: Unwrap a single unfrosted Raspberry Lemon Heaven Cupcake and place on a microwave-safe plate. Heat at 50% power for 15 seconds, check, and add another 10 seconds if needed. Microwaving at full power risks a rubbery texture, so low-and-slow is essential. Frost after reheating for the best presentation and flavor.
- Air Fryer Reheat: Set your air fryer to 280°F (140°C) and place unfrosted cupcakes in the basket in a single layer. Heat for 3 minutes, checking after 2 minutes. The circulating air gently warms the interior of these Raspberry Lemon Heaven Cupcakes while keeping the exterior slightly crisp. Apply fresh frosting and garnish once cooled for 5 minutes.
- Prep Time: 15
- Cook Time: 20
- Category: Desserts & Sweets
- Method: Baking
- Cuisine: American
Nutrition
- Serving Size: 2 cupcakes
- Calories: 512 calories
- Sugar: 56g
- Sodium: 248mg
- Fat: 24g
- Saturated Fat: 15g
- Unsaturated Fat: 3g
- Trans Fat: 0g
- Carbohydrates: 72g
- Fiber: 2g
- Protein: 6g
- Cholesterol: 112mg
const elementHref = anchor.getAttribute( 'href' ); if ( ! elementHref ) { return; }
e.preventDefault(); this.goToSelector( elementHref ); }); }, goToSelector( selector ) { const element = document.querySelector( selector ); if ( ! element ) { return; } element.scrollIntoView( { behavior: 'smooth' } ); } };
document.addEventListener( 'DOMContentLoaded', () => window.TastyRecipes.smoothScroll.init() );
(function(){
var bothEquals = function( d1, d2, D ) {
var ret = 0;
if (d1<=D) {
ret++;
}
if (d2<=D) {
ret++;
}
return ret === 2;
};var frac =function frac(x,D,mixed){var n1=Math.floor(x),d1=1;var n2=n1+1,d2=1;if(x!==n1){while(bothEquals(d1,d2,D)){var m=(n1+n2)/(d1+d2);if(x===m){if(d1+d2<=D){d1+=d2;n1+=n2;d2=D+1}else if(d1>d2){d2=D+1;}else {d1=D+1;}break}else if(x
window.tastyRecipesVulgarFractions = JSON.parse(decodeURIComponent("%7B%22%C2%BC%22%3A%221%2F4%22%2C%22%C2%BD%22%3A%221%2F2%22%2C%22%C2%BE%22%3A%223%2F4%22%2C%22%E2%85%93%22%3A%221%2F3%22%2C%22%E2%85%94%22%3A%222%2F3%22%2C%22%E2%85%95%22%3A%221%2F5%22%2C%22%E2%85%96%22%3A%222%2F5%22%2C%22%E2%85%97%22%3A%223%2F5%22%2C%22%E2%85%98%22%3A%224%2F5%22%2C%22%E2%85%99%22%3A%221%2F6%22%2C%22%E2%85%9A%22%3A%225%2F6%22%2C%22%E2%85%9B%22%3A%221%2F8%22%2C%22%E2%85%9C%22%3A%223%2F8%22%2C%22%E2%85%9D%22%3A%225%2F8%22%2C%22%E2%85%9E%22%3A%227%2F8%22%7D"));
window.tastyRecipesFormatAmount = function(amount, el) { if ( parseFloat( amount ) === parseInt( amount ) ) { return amount; } var roundType = 'frac'; if (typeof el.dataset.amountShouldRound !== 'undefined') { if ('false' !== el.dataset.amountShouldRound) { if ( 'number' === el.dataset.amountShouldRound ) { roundType = 'number'; } else if ('frac' === el.dataset.amountShouldRound) { roundType = 'frac'; } else if ('vulgar' === el.dataset.amountShouldRound) { roundType = 'vulgar'; } else { roundType = 'integer'; } } } if ('number' === roundType) { amount = Number.parseFloat(amount).toPrecision(2); } else if ('integer' === roundType) { amount = Math.round(amount); } else if ('frac' === roundType || 'vulgar' === roundType) { var denom = 8; if (typeof el.dataset.unit !== 'undefined') { var unit = el.dataset.unit; if (['cups','cup','c'].includes(unit)) { denom = 4; if (0.125 === amount) { denom = 8; } if ("0.1667" === Number.parseFloat( amount ).toPrecision(4)) { denom = 6; } } if (['tablespoons','tablespoon','tbsp'].includes(unit)) { denom = 2; } if (['teaspoons','teaspoon','tsp'].includes(unit)) { denom = 8; } } var amountArray = frac.cont( amount, denom, true ); var newAmount = ''; if ( amountArray[1] !== 0 ) { newAmount = amountArray[1] + '/' + amountArray[2]; if ('vulgar' === roundType) { Object.keys(window.tastyRecipesVulgarFractions).forEach(function(vulgar) { if (newAmount === window.tastyRecipesVulgarFractions[vulgar]) { newAmount = vulgar; } }); } } if ( newAmount ) { newAmount = ' ' + newAmount; } if ( amountArray[0] ) { newAmount = amountArray[0] + newAmount; } amount = newAmount; } return amount; };
window.tastyRecipesUpdatePrintLink = () => {
const printButton = document.querySelector( '.tasty-recipes-print-button' );
if ( ! printButton ) { return; }
const printURL = new URL( printButton.href ); const searchParams = new URLSearchParams( printURL.search );
const unitButton = document.querySelector( '.tasty-recipes-convert-button-active' ); const scaleButton = document.querySelector( '.tasty-recipes-scale-button-active' );
let unit = ''; let scale = '';
if ( unitButton ) { unit = unitButton.dataset.unitType; searchParams.delete('unit'); searchParams.set( 'unit', unit ); }
if ( scaleButton ) { scale = scaleButton.dataset.amount; searchParams.set( 'scale', scale ); }
const paramString = searchParams.toString(); const newURL = '' === paramString ? printURL.href : printURL.origin + printURL.pathname + '?' + paramString; const printLinks = document.querySelectorAll( '.tasty-recipes-print-link' );
printLinks.forEach( ( el ) => { el.href = newURL; });
const printButtons = document.querySelectorAll( '.tasty-recipes-print-button' ); printButtons.forEach( ( el ) => { el.href = newURL; }); };
document.addEventListener( 'DOMContentLoaded', () => {
if ( ! window.location.href.includes( '/print/' ) ) { return; }
const searchParams = new URLSearchParams( window.location.search );
const unit = searchParams.get( 'unit' ); const scale = searchParams.get( 'scale' );
if ( unit && ( 'metric' === unit || 'usc' === unit ) ) { document.querySelector( '.tasty-recipes-convert-button[data-unit-type="' + unit + '"]' ).click(); }
if ( scale && Number(scale) > 0 ) { document.querySelector( '.tasty-recipes-scale-button[data-amount="' + Number(scale) + '"]' ).click(); } }); }());
(function(){ var buttonClass = 'tasty-recipes-scale-button', buttonActiveClass = 'tasty-recipes-scale-button-active', buttons = document.querySelectorAll('.tasty-recipes-scale-button'); if ( ! buttons ) { return; }
buttons.forEach(function(button){ button.addEventListener('click', function(event){ event.preventDefault(); var recipe = event.target.closest('.tasty-recipes'); if ( ! recipe ) { return; } var otherButtons = recipe.querySelectorAll('.' + buttonClass); otherButtons.forEach(function(bt){ bt.classList.remove(buttonActiveClass); }); button.classList.add(buttonActiveClass);
var scalables = recipe.querySelectorAll('span[data-amount]'); var buttonAmount = parseFloat( button.dataset.amount ); scalables.forEach(function(scalable){ if (typeof scalable.dataset.amountOriginalType === 'undefined' && typeof scalable.dataset.nfOriginal === 'undefined') { if (-1 !== scalable.innerText.indexOf('/')) { scalable.dataset.amountOriginalType = 'frac'; } if (-1 !== scalable.innerText.indexOf('.')) { scalable.dataset.amountOriginalType = 'number'; } Object.keys(window.tastyRecipesVulgarFractions).forEach(function(vulgar) { if (-1 !== scalable.innerText.indexOf(vulgar)) { scalable.dataset.amountOriginalType = 'vulgar'; } }); if (typeof scalable.dataset.amountOriginalType !== 'undefined') { scalable.dataset.amountShouldRound = scalable.dataset.amountOriginalType; } } var amount = parseFloat( scalable.dataset.amount ) * buttonAmount; amount = window.tastyRecipesFormatAmount(amount, scalable); if ( typeof scalable.dataset.unit !== 'undefined' ) { if ( ! scalable.classList.contains('nutrifox-quantity') ) { if ( ! scalable.classList.contains('nutrifox-second-quantity') ) { amount += ' ' + scalable.dataset.unit; } } } scalable.innerText = amount; });
var nonNumerics = recipe.querySelectorAll('[data-has-non-numeric-amount]'); nonNumerics.forEach(function(nonNumeric){ var indicator = nonNumeric.querySelector('span[data-non-numeric-label]'); if ( indicator ) { nonNumeric.removeChild(indicator); } if ( 1 !== buttonAmount ) { indicator = document.createElement('span'); indicator.setAttribute('data-non-numeric-label', true); var text = document.createTextNode(' (x' + buttonAmount + ')'); indicator.appendChild(text); nonNumeric.appendChild(indicator); } });
window.tastyRecipesUpdatePrintLink(); }); }); }());
(function() {
document.querySelectorAll('.tasty-recipes-copy-button').forEach(function(copyButton) { if (copyButton.getAttribute('data-tasty-recipes-click-event')) { return; } copyButton.setAttribute('data-tasty-recipes-click-event', true);
copyButton.addEventListener('click', function(event) { event.preventDefault(); var copyContainer = copyButton.closest('.tasty-recipes-ingredients-clipboard-container');
var messageText = copyButton.attributes.getNamedItem('data-success').nodeValue; var copySuccessMessage = document.createElement('div'); var copySuccessParagraph = document.createElement('p'); copySuccessParagraph.innerText = messageText; copySuccessMessage.appendChild(copySuccessParagraph); copySuccessMessage.classList.add('tasty-recipes-flash-message'); var messageDuration = 3000;
var ingredients = []; var ingredientsContainer = copyButton.closest('.tasty-recipes-ingredients') || copyButton.closest('.tasty-recipe-ingredients'); var foundIngredients = false; var findIngredients = function(div) { if ( div.querySelectorAll('li').length ) { div.querySelectorAll('li').forEach(function(li) { ingredients.push(li.innerText); }); foundIngredients = true; } else if ( div.querySelectorAll('p').length ) { div.querySelectorAll('p').forEach(function(p) { ingredients.push(p.innerText); }); foundIngredients = true; } }; if (ingredientsContainer.querySelector('.tasty-recipes-ingredients-body')) { findIngredients(ingredientsContainer.querySelector('.tasty-recipes-ingredients-body')); } else { ingredientsContainer.querySelectorAll('div').forEach(function(div) { if ( foundIngredients ) { return; } if ( div.classList.contains('tasty-recipes-ingredients-header') || div.parentElement.classList.contains('tasty-recipes-ingredients-header') || div.classList.contains('tasty-recipes-ingredients-header') ) { return; } findIngredients(div); }); }
var readableIngredients = ''; ingredients.forEach(function(ingredient) { readableIngredients += ingredient + '\n'; }); readableIngredients = readableIngredients.trim();
var fakeElem = document.createElement("textarea"); fakeElem.style.fontSize = "12pt"; fakeElem.style.border = "0"; fakeElem.style.padding = "0"; fakeElem.style.margin = "0"; fakeElem.style.position = "absolute"; fakeElem.style.left = "-9999px";
var yPosition = window.pageYOffset || document.documentElement.scrollTop; fakeElem.style.top = yPosition + 'px';
fakeElem.setAttribute("readonly", ""); fakeElem.value = readableIngredients;
document.body.appendChild(fakeElem);
if (navigator.userAgent.match(/ipad|iphone/i)) { var range = document.createRange();
var selection = window.getSelection(); range.selectNodeContents(fakeElem); selection.removeAllRanges(); selection.addRange(range); fakeElem.setSelectionRange(0, 999999); } else { fakeElem.select(); }
document.execCommand("copy");
document.body.removeChild(fakeElem); fakeElem = null;
copyContainer.appendChild(copySuccessMessage);
setTimeout(function() { copyContainer.removeChild(copySuccessMessage); }, messageDuration); }); });
}());
(function(){ document.querySelectorAll('[data-tr-ingredient-checkbox]').forEach(function(el) { var input = el.querySelector('.tr-ingredient-checkbox-container input[type="checkbox"]'); if ( ! input ) { return; } if (input.checked) { el.dataset.trIngredientCheckbox = 'checked'; } el.addEventListener('click', function(event) { if ( 'A' === event.target.nodeName || 'INPUT' === event.target.nodeName || 'LABEL' === event.target.nodeName ) { return; } input.click(); }); input.addEventListener('change', function() { el.dataset.trIngredientCheckbox = input.checked ? 'checked' : ''; }); }); }());
window.TastyRecipes = window.TastyRecipes || {}; window.TastyRecipes.cookMode = { wakeLockApi: false, wakeLock: false, cookModeSelector: '.tasty-recipes-cook-mode', init() { if ("wakeLock" in navigator && "request" in navigator.wakeLock) { this.wakeLockApi = navigator.wakeLock; }
const cookModes = document.querySelectorAll(this.cookModeSelector);
if (cookModes.length > 0) { for (const cookMode of cookModes) { if (this.wakeLockApi) { cookMode.querySelector('input[type="checkbox"]').addEventListener("change", event => { this.checkboxChange(event.target); }, false); } else { cookMode.style.display = "none"; } } } }, checkboxChange(checkbox) { if (checkbox.checked) { this.lock(); } else { this.unlock(); } }, setCheckboxesState(state) { const checkboxes = document.querySelectorAll(this.cookModeSelector + ' input[type="checkbox"]'); for (const checkbox of checkboxes) { checkbox.checked = state; } }, async lock() { try { this.wakeLock = await this.wakeLockApi.request("screen"); this.wakeLock.addEventListener("release", () => { this.wakeLock = false; this.setCheckboxesState(false); }); this.setCheckboxesState(true); } catch (error) { this.setCheckboxesState(false); } }, unlock() { if (this.wakeLock) { this.wakeLock.release(); this.wakeLock = false; } this.setCheckboxesState(false); } };
(function(callback) { if (document.readyState !== "loading") { callback(); } else { document.addEventListener("DOMContentLoaded", callback); } })(() => { window.TastyRecipes.cookMode.init(); });
window.TastyRecipes = window.TastyRecipes || {};
window.TastyRecipes.staticTooltip = { element: null, tooltipElement: null, deleting: false, init( element ) { if ( this.deleting ) { return; } this.element = element; this.buildElements(); }, destroy() { if ( ! this.tooltipElement || this.deleting ) { return; }
this.deleting = true; this.tooltipElement.classList.remove( 'opened' );
setTimeout( () => { this.tooltipElement.remove(); this.deleting = false; }, 500 ); }, buildElements() { const tooltipElement = document.createElement( 'div' ); tooltipElement.classList.add( 'tasty-recipes-static-tooltip'); tooltipElement.setAttribute( 'id', 'tasty-recipes-tooltip' );
const currentTooltipElement = document.getElementById( 'tasty-recipes-tooltip' ); if ( currentTooltipElement ) { document.body.replaceChild( tooltipElement, currentTooltipElement ); } else { document.body.appendChild( tooltipElement ); }
this.tooltipElement = document.getElementById( 'tasty-recipes-tooltip' ); }, show() { if ( ! this.tooltipElement ) { return; }
const tooltipTop = this.element.getBoundingClientRect().top + window.scrollY - 10 // 10px offset. - this.tooltipElement.getBoundingClientRect().height; const tooltipLeft = this.element.getBoundingClientRect().left - ( this.tooltipElement.getBoundingClientRect().width / 2 ) + ( this.element.getBoundingClientRect().width / 2 ) - 1; const posLeft = Math.max( 10, tooltipLeft ); this.maybeRemoveTail( posLeft !== tooltipLeft );
this.tooltipElement.setAttribute( 'style', 'top:' + tooltipTop + 'px;left:' + posLeft + 'px;' ); this.tooltipElement.classList.add( 'opened' );
}, maybeRemoveTail( removeTail ) { if ( removeTail ) { this.tooltipElement.classList.add( 'tr-hide-tail' ); } else { this.tooltipElement.classList.remove( 'tr-hide-tail' ); } }, changeMessage( message ) { if ( ! this.tooltipElement ) { return; } this.tooltipElement.innerHTML = message; } };
window.TastyRecipes.ajax = { sendPostRequest( url, data, success, failure ) { const xhr = new XMLHttpRequest(); xhr.open( 'POST', url, true ); xhr.send( this.preparePostData( data ) );
xhr.onreadystatechange = () => { if ( 4 !== xhr.readyState ) { return; } if ( xhr.status === 200 ) { success( JSON.parse( xhr.responseText ) ); return; }
failure( xhr ); };
xhr.onerror = () => { failure( xhr ); }; }, preparePostData( data ) { const formData = new FormData();
for ( const key in data ) { formData.append( key, data[key] ); } return formData; }, };
window.TastyRecipes.ratings = { defaultRating: 0, currentRatingPercentage: 100, savingRating: false, init( minRating ) { this.minRating = minRating;
this.formWatchRating(); this.closeTooltipWhenClickOutside(); this.addBodyClassBasedOnSelectedRating(); this.backwardCompFormRatingPosition(); }, formWatchRating() { const ratings = document.querySelectorAll('.tasty-recipes-no-ratings-buttons [data-rating]'); if ( ratings.length <= 0 ) { return; } for ( const rating of ratings ) { rating.addEventListener( 'click', event => { event.preventDefault(); this.defaultRating = event.target.closest( '.checked' ).dataset.rating; this.setCheckedStar( event.target ); this.maybeSendRating( this.defaultRating, event.target ); this.setRatingInForm( this.defaultRating ); } ); } }, closeTooltipWhenClickOutside() { window.addEventListener( 'click', e => { // Bailout (don't remove the tooltip) when the clicked element is a rating star, or it's the tooltip itself. if ( e.target.closest( '.tasty-recipes-rating' ) || e.target.classList.contains( 'tasty-recipes-static-tooltip' ) ) { return; }
window.TastyRecipes.staticTooltip.destroy(); } ); }, setRatingInForm( rating ) { const ratingInput = document.querySelector( '#respond .tasty-recipes-rating[value="' + rating + '"]' ); if ( ! ratingInput ) { return; } ratingInput.click(); }, addBodyClassBasedOnSelectedRating() { const ratingInputs = document.querySelectorAll( 'input.tasty-recipes-rating' ); if ( ! ratingInputs ) { return; } for ( const ratingInput of ratingInputs ) { ratingInput.addEventListener( 'click', currentEvent => { const selectedRating = currentEvent.target.getAttribute( 'value' ); this.handleBodyClassByRating( selectedRating ); this.toggleCommentTextareaRequired( selectedRating ); } ); } }, handleBodyClassByRating( rating ) { if ( rating < this.minRating ) { document.body.classList.remove( 'tasty-recipes-selected-minimum-rating' ); return; } document.body.classList.add( 'tasty-recipes-selected-minimum-rating' ); }, toggleCommentTextareaRequired( rating ) { const commentTextarea = document.getElementById( 'comment' ); if ( ! commentTextarea ) { return; }if ( rating < this.minRating ) { commentTextarea.setAttribute( 'required', '' ); return; }commentTextarea.removeAttribute( 'required' ); }, maybeSendRating( rating, element ) { if ( this.savingRating === rating ) { return; }this.savingRating = rating; window.TastyRecipes.staticTooltip.init( element );const recipeCardElement = element.closest( '.tasty-recipes' ); if ( ! recipeCardElement ) { window.TastyRecipes.staticTooltip.destroy(); return; }window.TastyRecipes.ajax.sendPostRequest( window.trCommon.ajaxurl, { action: 'tasty_recipes_save_rating', rating, nonce: window.trCommon.ratingNonce, post_id: window.trCommon.postId, recipe_id: recipeCardElement.dataset.trId, }, ( response ) => { window.TastyRecipes.staticTooltip.changeMessage( response.data.message ); window.TastyRecipes.staticTooltip.show(); this.updateAverageText( response.data, recipeCardElement ); this.maybeFillCommentForm( response.data );
// Hide the tooltip after 5 seconds. setTimeout( () => { this.maybeResetTooltip( recipeCardElement, response.data, rating ); }, 5000 ); }, () => { this.resetTooltip( recipeCardElement ); } ); }, updateAverageText( data, recipeCardElement ) { if ( ! data.average ) { return; } this.setRatingPercent( data );
if ( ! data.count ) { return; }
const quickLink = document.querySelector( '.tasty-recipes-rating-link' ); if ( quickLink ) { this.setTextInContainer( quickLink, data ); this.setPartialStar( quickLink ); }
const cardStars = recipeCardElement.querySelector( '.tasty-recipes-ratings-buttons' ); cardStars.dataset.trDefaultRating = data.average; this.setTextInContainer( recipeCardElement.querySelector( '.tasty-recipes-rating' ), data ); }, setTextInContainer( container, data ) { if ( ! container ) { return; }
if ( data.label ) { const ratingLabelElement = container.querySelector( '.rating-label' ); if ( ratingLabelElement ) { ratingLabelElement.innerHTML = data.label; } return; }
const averageElement = container.querySelector( '.average' ); if ( averageElement ) { averageElement.textContent = data.average; }
const countElement = container.querySelector( '.count' ); if ( countElement ) { countElement.textContent = data.count; } }, setPartialStar( container ) { const highestStar = container.querySelector( '[data-rating="' + Math.ceil( this.defaultRating ) + '"]' ); if ( highestStar ) { highestStar.dataset.trClip = this.currentRatingPercentage; } }, setRatingPercent( data ) { this.defaultRating = data.average.toFixed( 1 ); const parts = data.average.toFixed( 2 ).toString().split( '.' ); this.currentRatingPercentage = parts[1] ? parts[1] : 100; if ( this.currentRatingPercentage === '00' ) { this.currentRatingPercentage = 100; } }, setCheckedStar( target ) { const cardRatingContainer = target.closest( '.tasty-recipes-ratings-buttons' ); const selectedRatingElement = cardRatingContainer.querySelector( '[data-tr-checked]' ); if ( selectedRatingElement ) { delete selectedRatingElement.dataset.trChecked; }
const thisStar = target.closest( '.tasty-recipes-rating' ); thisStar.dataset.trChecked = 1; thisStar.querySelector( '[data-tr-clip]' ).dataset.trClip = 100; }, maybeFillCommentForm( data ) { if ( ! data.comment || ! data.comment.content ) { return; }
const commentForm = document.querySelector( '#commentform' ); if ( ! commentForm ) { return; }
const commentBox = commentForm.querySelector( '[name=comment]' ); if ( ! commentBox || commentBox.value ) { return; }
// Add comment details for editing. commentBox.innerHTML = data.comment.content; if ( data.comment.name ) { commentForm.querySelector( '[name=author]' ).value = data.comment.name; commentForm.querySelector( '[name=email]' ).value = data.comment.email; } }, maybeResetTooltip( recipeCardElement, data, rating ) { if ( this.savingRating === rating ) { this.resetTooltip( recipeCardElement, data ); } }, resetTooltip( recipeCardElement, data ) { window.TastyRecipes.staticTooltip.destroy(); this.savingRating = false;
// Reset the default rating. const cardRatingContainer = recipeCardElement.querySelector( '.tasty-recipes-ratings-buttons' ); if ( cardRatingContainer ) { this.defaultRating = ( data && data.average ) ? data.average.toFixed(1) : cardRatingContainer.dataset.trDefaultRating; cardRatingContainer.dataset.trDefaultRating = this.defaultRating;
this.resetSelectedStar( cardRatingContainer, data ); } }, resetSelectedStar( cardRatingContainer ) { const selectedRatingElement = cardRatingContainer.querySelector( '[data-rating="' + Math.ceil( this.defaultRating ) + '"]' ); if ( selectedRatingElement ) { selectedRatingElement.querySelector( '[data-tr-clip]' ).dataset.trClip = this.currentRatingPercentage; selectedRatingElement.parentNode.dataset.trChecked = 1; }
const previousSelectedElement= cardRatingContainer.querySelector( '[data-tr-checked]' ); if ( previousSelectedElement ) { const currentSelectedRating = previousSelectedElement.querySelector('[data-rating]'); if ( currentSelectedRating !== selectedRatingElement ) { delete previousSelectedElement.dataset.trChecked; } } }, backwardCompFormRatingPosition() { const ratingsButtons = document.querySelector( '#respond .tasty-recipes-ratings-buttons, #tasty-recipes-comment-rating .tasty-recipes-ratings-buttons' ); if ( ! ratingsButtons ) { return; } const ratingsButtonsStyles = window.getComputedStyle(ratingsButtons); if ( ! ratingsButtonsStyles.display.includes( 'flex' ) ) { ratingsButtons.style.direction = 'rtl'; }
if ( typeof tastyRecipesRating !== 'undefined' ) { // Select the rating that was previously selected in admin. ratingsButtons.querySelector( '.tasty-recipes-rating[value="' + tastyRecipesRating + '"]' ).checked = true; }
const ratingSpans = ratingsButtons.querySelectorAll( '.tasty-recipes-rating' ); for (const ratingSpan of ratingSpans) { ratingSpan.addEventListener( 'click', event => { if ( ratingSpan === event.target ) { return; } ratingSpan.previousElementSibling.click(); } ); } } };
(function(callback) { if (document.readyState !== "loading") { callback(); } else { window.addEventListener( 'load', callback ); } })(() => { window.TastyRecipes.ratings.init( window.trCommon ? window.trCommon.minRating : 4 ); });











I made the frosting exactly as written and not only is it too much butter and not enough powder
sugar, there is nowhere near enough frosting to cover even six cupcakes. Have you made any adjustments? I am going to adjust since I have frosted the cupcakes yet.