This post was originally published on this site
There are good tacos, and then there’s this vegan taco recipe. Smoky roasted cauliflower, creamy chipotle sauce, and a warm tortilla to hold it all together—this is what weeknight dinner dreams are made of. Bold, flavorful, and ridiculously easy, it’s a guaranteed good time in taco form.

You know that feeling when dinnertime rolls around, and you want something really good—but also really easy? Same. That’s exactly how these smoky roasted cauliflower tacos came to life. The oven does most of the work, giving the cauliflower a deep, golden char while you blend up a creamy chipotle sauce that takes about a minute. The result? A taco that feels restaurant-level good but is secretly effortless.
Every bite is smoky, tangy, creamy, and just the right amount of spicy—wrapped up in a warm tortilla and topped with all the fresh, bright things. It’s a weeknight win, but also one of those meals that makes dinner feel a little extra special. And bonus? It meal preps beautifully, meaning you can have taco night twice if you’re lucky.
Why You’ll Love This Vegan Taco Recipe
Some meals just check all the boxes, and this is one of them. These smoky roasted cauliflower tacos are easy to make, packed with bold flavor, and the kind of dinner that feels effortless but still a little special. Whether you’re looking for a quick weeknight meal, something meal-prep friendly, or just a solid taco recipe—this one delivers. Here’s more reasons why you’ll love it:
- Smoky & Flavorful: Roasting cauliflower with chipotle and adobo sauce brings deep, smoky heat that makes every bite bold and satisfying.
- Ready in 40 Minutes: Minimal prep, the oven does most of the work, and everything comes together fast.
- Naturally Vegan & Easy to Customize: Keep it classic or add protein, swap sauces, or load up on toppings—it’s flexible and works for everyone.
- That Sauce Though: The creamy chipotle sauce ties everything together with a rich, tangy, slightly spicy kick.
- Meal-Prep Friendly: Roast the cauliflower and make the sauce ahead, then assemble fresh for a quick, no-stress meal.
Ingredients You’ll Need
Every ingredient in these smoky roasted cauliflower tacos pulls its weight—bringing in bold flavors, creamy textures, and the perfect balance of heat and freshness. The best part? This is a short, simple ingredient list with big impact. Here’s what makes each one essential:
How To Roast Cauliflower for Tacos
- Cauliflower: The heart of these tacos. Roasting deepens its flavor and gives it crispy edges while soaking up all the smoky, spiced goodness. Tip: To get the best caramelization, don’t overcrowd the pan—give each piece some space.
- Chipotle Peppers in Adobo: These little powerhouses bring smoky, spicy depth to the cauliflower. Use one for mild heat, two for a bolder kick! Don’t toss any of the adobo sauce—reserve and use it to add extra richness and complexity.

Creamy Chipotle Sauce Ingredients
- Vegan Sour Cream: The perfect cool, creamy contrast to the smoky cauliflower. It smooths everything out while adding a little tang. You can swap this for cashew cream or a thick, unflavored and unsweetened vegan yogurt if needed. Try our homemade vegan yogurt for a wholesome DIY choice!
- Garlic: A small but mighty ingredient! Raw garlic gives the chipotle cream a punchy, savory bite, balancing out the richness.
- Fresh Lime Juice: Brightens up the sauce and cuts through the spice. Always use fresh lime juice—it makes a difference!
Building the Perfect Vegan Taco
- Corn Tortillas: The classic base for tacos, adding that slightly chewy, lightly toasted texture that holds everything together.
- Avocado: Because tacos and avocado belong together. The buttery, creamy texture pairs perfectly with the smoky cauliflower and zesty sauce.
- Cilantro: A fresh, herbaceous kick that makes everything pop. If you’re in the cilantro-tastes-like-soap club, swap it for fresh parsley or thinly sliced green onions.
- Lime Wedges: A final squeeze of fresh lime juice right before eating wakes up all the flavors. Don’t skip this part!

Make It Your Own: Variations & Customizations
One of the best things about this vegan taco recipe is how easy it is to customize. Whether you want to amp up the heat, add extra protein, or switch up the toppings, these smoky roasted cauliflower tacos are flexible enough to make them exactly how you like. Here are a few ways to switch things up:
Want More (or Less) Heat?
- Spicy: Add an extra chipotle pepper or a pinch of cayenne to the sauce. A drizzle of hot sauce or pickled jalapeños wouldn’t hurt either.
- Mild: Use just half a chipotle pepper and skip the adobo sauce for a subtle smoky flavor without the heat.
Sauce Swaps
- Cashew Cream: Blend soaked cashews with lime juice, garlic, and water for a creamy, homemade alternative.
- Tahini Sauce: Adds a nutty, slightly earthy flavor that pairs well with smoky cauliflower.
- Guacamole: Skip the sauce altogether and load up with mashed avocado and a squeeze of lime.
Protein Add-Ins
- Black Beans or Refried Beans: Spread a layer on the tortilla before adding the cauliflower for extra heartiness.
- Crispy Tofu or Tempeh: Crumbled, seasoned, and pan-fried for a protein boost.
- Grilled Mushrooms: If you love a meaty bite, smoky grilled mushrooms are a great addition.
Tortilla Choices
- Flour Tortillas: A softer, slightly chewier option if you’re not a corn tortilla purist.
- Lettuce Wraps: Swap tortillas for crisp romaine or butter lettuce for a light, fresh twist.
- Hard Shell Tacos: If you love crunch, go for it!
Extra Topping Ideas
- Pickled red onions for a tangy bite.
- Shredded cabbage for a little extra crunch.
- Roasted corn or mango salsa for a touch of sweetness.
Whether you keep it simple and classic or load them up with all the extras, these tacos are easy to make your own.
How to Make These Smoky Roasted Cauliflower Tacos
This vegan taco recipe is the perfect mix of bold flavor and effortless cooking—the oven does most of the work, and all you have to do is blend up a quick sauce and assemble. The result? A smoky, creamy, flavor-packed taco night without the stress. Here’s what you’ll do. For full recipe details, scroll to the end of this post!


Step 1: Roast the Cauliflower – Preheat your oven to 400°F and line a baking sheet with parchment. Toss the cauliflower with chipotle peppers, adobo sauce, salt, and pepper, then spread it out in a single layer. Roast until golden and tender, flipping halfway through for even browning.
Step 2: Make the Chipotle Cream – In a small blender or food processor, combine vegan sour cream, chipotle, garlic, lime juice, and a pinch of salt. Blend until smooth and creamy. Taste and adjust—more lime for brightness, more chipotle for spice!
Step 3: Warm the Tortillas – Heat corn tortillas in a dry skillet for 30 seconds per side or directly over a gas flame for a slight char. This makes them softer, more flavorful, and less likely to break when filled.
Step 4: Assemble the Tacos – Spread a spoonful of chipotle cream onto each tortilla, then pile on the roasted cauliflower, avocado slices, and fresh cilantro.
Step 5: Serve & Enjoy! – Finish with a squeeze of fresh lime and any extra toppings you love—think pickled onions, shredded cabbage, or a drizzle of hot sauce. Serve immediately and get ready for a seriously good taco night!

Best Sides for Your Vegan Taco Night
These smoky roasted cauliflower tacos are amazing on their own, but pairing this vegan taco recipe with the right sides and toppings can take taco night to the next level. Whether you’re craving something fresh, crunchy, or a little indulgent, here are some easy and delicious ideas to round out your meal.
Fresh & Flavorful Additions
- Guacamole: Because tacos and guac are a perfect match. Keep it simple with mashed avocado, lime, and salt, or go all out with diced tomatoes, onions, and cilantro.
- Pico de Gallo: A fresh, juicy mix of tomatoes, onions, jalapeño, lime, and cilantro. Adds brightness and a little crunch.
- Pickled Red Onions: Tangy, vibrant, and ridiculously easy to make. Just soak thinly sliced onions in vinegar, salt, and a touch of sweetness.
Side Dishes for the Ultimate Taco Night
- Mexican Street Corn (Elote or Esquites): Grilled corn slathered in lime, vegan mayo, and chili powder or served in a cup as esquites.
- Refried Black Beans: Creamy, smoky, and the perfect hearty side to balance the tacos.
- Cilantro Lime Rice: Light, fluffy, and infused with citrusy brightness. A great way to bulk up the meal!
Extra Heat & Flavor Boosters
- Hot Sauce Bar: Set out different hot sauces for everyone to customize their spice level. Try smoky chipotle, classic verde, or something with a fruity kick.
- Crispy Tortilla Chips: Serve with salsa, guac, or a vegan queso for extra crunch.
- Lime Wedges: A final squeeze of lime ties everything together—don’t skip it!
Whether you’re keeping it simple with a side of guac or going all-in with rice, beans, and elote, these tacos fit right into any taco night lineup.
FAQs
Vegan tacos are all about bold flavors and creative fillings! Roasted vegetables (like cauliflower, mushrooms, or sweet potatoes) bring depth and texture, while legumes like black beans, chickpeas, or lentils add protein. Many recipes also use tofu, tempeh, or walnuts for a hearty bite, and toppings like avocado, pico de gallo, pickled onions, and creamy sauces make every bite fresh and flavorful. The key? Layering flavors and textures for a taco that’s just as satisfying as the original.
There are so many delicious plant-based alternatives! Roasted cauliflower (like in this recipe!) has a great texture and soaks up smoky spices beautifully. You can also try shredded jackfruit for a pulled pork-style taco, crispy tofu crumbles, or mushrooms sautéed with taco seasoning for a rich, umami-packed filling. If you’re looking for something protein-heavy, lentils or walnuts mixed with spices can create a ground “meat” texture that works beautifully in tacos.
The best sauce for vegan tacos depends on the flavor you want! A chipotle crema adds smoky heat, while a classic avocado crema brings a fresh, creamy contrast. For nutty depth, try a tahini-lime sauce or cashew crema, or go bright and spicy with salsa verde or pickled jalapeño sauce. No matter your choice, a good sauce ties everything together!

More Easy Vegan Taco Recipes To Try
- Veggie Grill Menu’s Koreatown Tacos
- Bang Bang Cauliflower Tacos
- Oyster Mushroom Tacos with Chipotle-Lime Sauce
- Korean-Style Tacos
- Crispy Hearts of Palm Tacos
Did you try this vegan taco recipe? I’d love to hear how it turned out. Leave a star rating and a comment below—your feedback makes my day!

Vegan Taco Recipe with Smoky Roasted Cauliflower
Total Time: 40 minutes
Yield: 4 servings
Diet: Vegan
Description
Smoky, spicy, and ridiculously easy—this vegan taco recipe is all about bold flavors with minimal effort. Roasted cauliflower brings the charred, crispy edges, while a creamy chipotle sauce ties everything together in the best way. Perfect for weeknights, meal prep, or when you just need tacos (aka always).
Ingredients
For the Roasted Cauliflower:
- 1 medium head cauliflower, cut into small florets
- 2 tablespoons neutral oil (canola, grapeseed, or avocado oil)
- 1 chipotle pepper from canned chipotles in adobo, finely minced
- 1 tablespoon adobo sauce (from the same can)
- ½ teaspoon sea salt
- Freshly ground black pepper, to taste
For the Chipotle Sauce:
- 7 ounces vegan sour cream
- 1 chipotle pepper from canned chipotles in adobo sauce
- 1 teaspoon minced garlic
- 2 teaspoons fresh lime juice
- Sea salt, to taste
For Assembling the Tacos:
- 8 small corn tortillas, warmed
- 1 ripe avocado, sliced
- A handful of fresh cilantro leaves
- Lime wedges, for serving
Instructions
Roast the Cauliflower:
- Preheat your oven to 400°F. Line a large baking sheet with parchment paper or a silicone mat.
- In a large bowl, toss the cauliflower florets with oil, minced chipotle pepper, adobo sauce, salt, and black pepper until evenly coated.
- Spread the cauliflower in a single layer on the baking sheet. Roast for 25–30 minutes, flipping halfway through, until golden brown and slightly crispy.
Make the Chipotle Sauce:
- In a small food processor or blender, combine the vegan sour cream, chipotle pepper, garlic, lime juice, and a pinch of salt. Blend until smooth. Taste and adjust the seasoning, adding more salt or lime juice if needed.
Assemble the Tacos:
- Warm the corn tortillas in a dry skillet over medium heat for about 30 seconds per side or directly over a gas flame for a slight char.
- Spread a spoonful of the chipotle sauce on each tortilla, then top with roasted cauliflower, avocado slices, and fresh cilantro.
- Serve immediately with lime wedges on the side for extra brightness.
Recipe Tweaks & Options:
- Make it crispier? Roast the cauliflower at 425°F or broil for the last 2–3 minutes.
- Lower the spice? Reduce the chipotle or skip the adobo sauce.
- More heat? Add a pinch of cayenne or extra chipotle to the sauce.
- Meal-prep friendly? Roast the cauliflower and make the sauce ahead—store separately and assemble fresh for best texture.
Notes
Storage & Reheating:
- Cauliflower: Store roasted cauliflower in an airtight container in the fridge for up to 4 days.
- Chipotle Sauce: Keeps well for up to 1 week in a sealed jar.
- Roasted cauliflower freezes well! Spread on a baking sheet to freeze individually, then transfer to an airtight container. Reheat in the oven at 400°F for 10 minutes for the best texture. The chipotle sauce isn’t ideal for freezing, but you can make it fresh in minutes.
- Reheating: For best texture, reheat cauliflower in a skillet over medium heat or in the oven at 350°F for 5–10 minutes. Avoid microwaving, as it softens the edges.
Make-Ahead Tips:
- Prep in Advance: Roast the cauliflower and blend the sauce ahead of time. Just warm the tortillas and assemble when ready to eat!
Gluten-Free Option:
- Use 100% corn tortillas or your favorite certified gluten-free option.
Air Fryer Variation:
- For extra crispiness: Air-fry seasoned cauliflower at 400°F for 15 minutes, shaking halfway through.
Easy Customizations:
- Boost the protein: Add black beans or refried beans to make these tacos more filling.
- Switch up the toppings: Try pickled red onions, shredded cabbage, or a drizzle of hot sauce for extra flavor.
- Sauce swap: Prefer a homemade option? Use a cashew-based crema instead of vegan sour cream.
Prep Time: 10 minutes
Cook Time: 30 minutes
Category: Dinner
Method: Baked, Roasted
Cuisine: American, Mexican-Inspired
window.trCommon={“minRating”:6,”ajaxurl”:”https://olivesfordinner.com/wp-admin/admin-ajax.php”,”ratingNonce”:””,”postId”:2176};
window.TastyRecipes = window.TastyRecipes || {};
window.TastyRecipes.smoothScroll = {
init() {
document.addEventListener( ‘click’, ( e ) => {
let anchor = e.target;
if ( anchor.tagName !== ‘A’ ) {
anchor = anchor.closest( ‘a.tasty-recipes-scrollto’ );
}
if ( ! anchor || ! anchor.classList.contains( ‘tasty-recipes-scrollto’ ) ) {
return;
}
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()
);
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 {
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 {
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 );
});
The post Vegan Taco Recipe With Smoky Roasted Cauliflower appeared first on Olives for Dinner.