How do I make twig variables available in node.html.twig accessible in my html.html.twig? I have a boolean field on my Content Type called 'field_bootstrap'. I have some twig logic in my node.html.twig file that, if the field is set to true, includes Bootstrap via HTML inclusion.

What I need is the ability to use my {{ node.field_bootstrap }} logic in the html.html.twig template, instead of the node-level template. This would allow me to reference Bootstrap's CDNs properly in my document's head, rather than its current position in the middle of body.

I assume I need to build a preprocess in mytheme.theme to make something like {{ custom_twig_variable }} available for use in html.html.twig but I'm a little lost on how to complete this :)

Thanks everyone!
Kevin is right, creating a library and then attaching it is the better approach for this.
theme-name.theme
THEME_NAME_preprocess_node(&amp;$variables) {
  $node = $variables['node'];
  if ($node-&gt;field_bootstrap-&gt;value) { // checks boolean is true
     $variables['#attached']['library'][] = 'theme-name/bootstrap-files';
  }
}

theme-name.libraries.yml
bootstrap-files:
  version: 1.x
  css:
    theme:
      css/boostrap.css: {}
  js:
    js/boostrap.js: {}
  dependencies:
    - core/jquery
    - core/jquery.once
    - core/drupal

and you'll have to put the bootstrap css and js files inside the /css and /js folders of your theme.

Better Yet
Install Bootstrap Library module.
theme-name.theme
THEME_NAME_preprocess_node(&amp;$variables) {
  if (\Drupal::moduleHandler()-&gt;moduleExists('bootstrap_library')) {
    $node = $variables['node'];
    if ($node-&gt;field_bootstrap-&gt;value) { // checks boolean is true
       $variables['#attached']['library'][] = 'bootstrap_library/bootstrap-cdn';
    }
  }
}