Just in time script template compilation