Extract scripts from templates