diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 3683d37..d89247e 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -12,6 +12,7 @@
 use Drupal\Core\Config\Config;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Template\Attribute;
+use Drupal\Core\Template\RenderableWrapper;
 use Drupal\Core\Utility\ThemeRegistry;
 use Drupal\Core\Theme\ThemeSettings;
 
@@ -2850,6 +2851,25 @@ function template_preprocess_html(&$variables) {
   if ($suggestions = theme_get_suggestions(arg(), 'html')) {
     $variables['theme_hook_suggestions'] = $suggestions;
   }
+
+  // Previous process layer.
+  drupal_add_library('system', 'html5shiv', TRUE);
+  // Render page_top and page_bottom into top level variables.
+  $variables['page_top'] = isset($variables['page']['page_top']) ? $variables['page']['page_top'] : array();
+  $variables['page_bottom'] = array();
+  $variables['page_bottom'][] = isset($variables['page']['page_bottom']) ? $variables['page']['page_bottom'] : array();
+  // Place the rendered HTML for the page body into a top level variable.
+  $variables['page'] = $variables['page']['#children'];
+  $variables['css'] = drupal_add_css();
+
+  // Replaced drupal_get_css() and drupal_get_js() so they return an object
+  // that can render itself on print.
+  $variables['head'] = new RenderableWrapper('drupal_get_html_head');
+  $variables['styles'] = new RenderableWrapper('drupal_get_css');
+  $variables['scripts'] = new RenderableWrapper('drupal_get_js');
+
+  $footer_scripts = new RenderableWrapper('drupal_get_js', array('footer'));
+  $variables['page_bottom'][] = array('#markup' => $footer_scripts);
 }
 
 /**
@@ -2976,30 +2996,6 @@ function template_process_page(&$variables) {
 }
 
 /**
- * Processes variables for html.html.twig.
- *
- * Perform final addition and modification of variables before passing into
- * the template. To customize these variables, call drupal_render() on elements
- * in $variables['page'] during THEME_preprocess_page().
- *
- * @see template_preprocess_html()
- */
-function template_process_html(&$variables) {
-  drupal_add_library('system', 'html5shiv', TRUE);
-  // Render page_top and page_bottom into top level variables.
-  $variables['page_top'] = isset($variables['page']['page_top']) ? drupal_render($variables['page']['page_top']) : '';
-  $variables['page_bottom'] = isset($variables['page']['page_bottom']) ? drupal_render($variables['page']['page_bottom']) : '';
-  // Place the rendered HTML for the page body into a top level variable.
-  $variables['page'] = $variables['page']['#children'];
-  $variables['page_bottom'] .= drupal_get_js('footer');
-
-  $variables['head']    = drupal_get_html_head();
-  $variables['css']     = drupal_add_css();
-  $variables['styles']  = drupal_get_css();
-  $variables['scripts'] = drupal_get_js();
-}
-
-/**
  * Generate an array of suggestions from path arguments.
  *
  * This is typically called for adding to the 'theme_hook_suggestions' or
@@ -3172,29 +3168,21 @@ function template_preprocess_maintenance_page(&$variables) {
   if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
     $variables['theme_hook_suggestion'] = 'maintenance_page__offline';
   }
-}
 
-/**
- * Theme process function for theme_maintenance_field().
- *
- * The variables array generated here is a mirror of template_process_html().
- * This processor will run its course when theme_maintenance_page() is invoked.
- *
- * @see maintenance-page.html.twig
- * @see template_process_html()
- */
-function template_process_maintenance_page(&$variables) {
   $variables['head'] = drupal_get_html_head();
 
   // While this code is used in the installer, the language module may not be
   // enabled yet (even maybe no database set up yet), but an RTL language
   // selected should result in RTL stylesheets loaded properly already.
+
   $variables['css'] = $css = drupal_add_css();
   include_once DRUPAL_ROOT . '/core/modules/language/language.module';
   language_css_alter($css);
-  $variables['styles'] = drupal_get_css($css);
 
-  $variables['scripts'] = drupal_get_js();
+  // Replaced drupal_get_css() and drupal_get_js() so they return an object
+  // that can render itself on print.
+  $variables['styles'] = new RenderableWrapper('drupal_get_css', $args = array($css));
+  $variables['scripts'] = new RenderableWrapper('drupal_get_js');
 }
 
 /**
diff --git a/core/lib/Drupal/Core/Template/RenderableWrapper.php b/core/lib/Drupal/Core/Template/RenderableWrapper.php
new file mode 100644
index 0000000..200d16b
--- /dev/null
+++ b/core/lib/Drupal/Core/Template/RenderableWrapper.php
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Template\RenderableWrapper.
+ */
+
+namespace Drupal\Core\Template;
+
+
+/**
+ * Renderable wrapper for drupal_get_* functions.
+ */
+
+
+/**
+ * A class that wraps drupal_get_* functions so they can be rendered in a template.
+ *
+ * To use, one may pass in the function name as a string followed by an array of
+ * arguments to the contstructor.
+ * @code
+ *  $variables['scripts'] = new RenderableWrapper('drupal_get_js');
+ *  {{ scripts }};
+ *  // Produces
+ *  <script src="http://domain.com/core/misc/script/script.min.js?v=2.6.2"></script>
+ * @endcode
+ *
+ */
+class RenderableWrapper {
+
+  /**
+   * Stores the callback function to be called when rendered.
+   *
+   * @var array
+   */
+  public $callback = NULL;
+
+  /**
+   * Stores the callback's arguments.
+   *
+   * @var array
+   */
+  public $args = array();
+
+  /**
+   * Constructor
+   *
+   * @param string $callback the callback function name
+   * @param array  $args
+   */
+  public function __construct($callback = NULL, $args = array()) {
+    $this->callback = $callback;
+    $this->args = $args;
+  }
+
+  /**
+   * Calls the render method.
+   *
+   * @return string the render method's results.
+   *
+   * @see render()
+   */
+  public function __toString() {
+    return $this->render();
+  }
+
+  /**
+   * Call the callback function.
+   *
+   * @return string the results of the drupal_get_* functions.
+   */
+  public function render() {
+   if (!empty($this->callback) && is_callable($this->callback)) {
+      return call_user_func_array($this->callback, $this->args);
+    }
+  }
+}
