smarter js templates