Place the tofu in a clean towel and set something heavy on top to help press out the extra moisture.
Let it press for 15-20 minutes to remove excess moisture.
Once pressed, cut the tofu into cubes, slices, or triangles.
In a food processor, blend basil, garlic, lemon juice, olive oil, pine nuts (or cashews), nutritional yeast, and salt until smooth.
If the mixture is too thick, add more olive oil to reach your desired consistency.
In a bowl, toss the tofu with half of the pesto until evenly coated.
Let it marinate for at least 30 minutes for maximum flavor.
Baking: Preheat the oven to 400°F (200°C), place tofu on a lined baking sheet, and bake for 20-25 minutes, flipping halfway.
Pan-frying: Heat 1 tablespoon of olive oil and cook tofu until golden brown on all sides.
Air-frying: Air-fry at 375°F (190°C) for 15 minutes, shaking the basket halfway through.
Toss the cooked tofu with the remaining pesto.
Serve over pasta, rice, or alongside a salad.