Load and render a twig template
$twig = \Drupal::service('twig');

$template = $twig->loadTemplate('path/to/your_template.html.twig');
$response = $template->render(['var1' => $var1, 'var2' => $var2]);
return $response;

var1 & var2 will also be pass as variable to twig template which we can use as follow
{{ var1 }}

Comments

VM’s picture

per https://www.drupal.org/node/643758 please edit your post and move it to the 'post installation' forum. Thank you.