Only as a last resort. Attrition rates holding ground without any strategic depth are usually unbearable.A smaller country with almost no strategic depth always try to hold it's ground, within own territory tries to catch the enemy like a web. Same as done in Vietnam war or Korean war up to some extent.
Offensives can be used as defense mechanisms. To ensure a fair fight, we need them to spread out, get distracted and thin their strike forces.
Attacking at various unexpected points forces them to do just that.