Add flexible classes to templates