diff -Nuar a/vendor/magento/framework/Config/ConfigOptionsListConstants.php b/vendor/magento/framework/Config/ConfigOptionsListConstants.php
--- a/vendor/magento/framework/Config/ConfigOptionsListConstants.php
+++ b/vendor/magento/framework/Config/ConfigOptionsListConstants.php
@@ -11,6 +11,8 @@ namespace Magento\Framework\Config;
  */
 class ConfigOptionsListConstants
 {
+    const CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION = 'static_content_on_demand_in_production';
+
     /**#@+
      * Path to the values in the deployment config
      */

diff -Nuar a/vendor/magento/framework/View/Design/FileResolution/Fallback/TemplateFile.php b/vendor/magento/framework/View/Design/FileResolution/Fallback/TemplateFile.php
--- a/vendor/magento/framework/View/Design/FileResolution/Fallback/TemplateFile.php
+++ b/vendor/magento/framework/View/Design/FileResolution/Fallback/TemplateFile.php
@@ -10,6 +10,9 @@ use Magento\Framework\App\State;
 use Magento\Framework\View\Asset\ConfigInterface;
 use Magento\Framework\View\Design\ThemeInterface;
 use Magento\Framework\View\Template\Html\MinifierInterface;
+use Magento\Framework\App\DeploymentConfig;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Config\ConfigOptionsListConstants;

 /**
  * Provider of template view files
@@ -32,20 +35,28 @@ class TemplateFile extends File
     protected $assetConfig;

     /**
+     * @var DeploymentConfig
+     */
+    private $deploymentConfig;
+
+    /**
      * @param ResolverInterface $resolver
      * @param MinifierInterface $templateMinifier
      * @param State $appState
      * @param ConfigInterface $assetConfig
+     * @param DeploymentConfig $deploymentConfig
      */
     public function __construct(
         ResolverInterface $resolver,
         MinifierInterface $templateMinifier,
         State $appState,
-        ConfigInterface $assetConfig
+        ConfigInterface $assetConfig,
+        DeploymentConfig $deploymentConfig = null
     ) {
         $this->appState = $appState;
         $this->templateMinifier = $templateMinifier;
         $this->assetConfig = $assetConfig;
+        $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
         parent::__construct($resolver);
     }

@@ -73,7 +84,7 @@ class TemplateFile extends File
         if ($template && $this->assetConfig->isMinifyHtml()) {
             switch ($this->appState->getMode()) {
                 case State::MODE_PRODUCTION:
-                    return $this->templateMinifier->getPathToMinified($template);
+                    return $this->getMinifiedTemplateInProduction($template);
                 case State::MODE_DEFAULT:
                     return $this->templateMinifier->getMinified($template);
                 case State::MODE_DEVELOPER:
@@ -83,4 +94,24 @@ class TemplateFile extends File
         }
         return $template;
     }
+
+    /**
+     * Returns path to minified template file
+     *
+     * If SCD on demand in production is disabled - returns the path to minified template file.
+     * Otherwise returns the path to minified template file,
+     * or minify if file not exist and returns path.
+     *
+     * @param string $template
+     * @return string
+     */
+    private function getMinifiedTemplateInProduction($template)
+    {
+        if ($this->deploymentConfig->getConfigData(
+            ConfigOptionsListConstants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION
+        )) {
+            return $this->templateMinifier->getMinified($template);
+        }
+        return $this->templateMinifier->getPathToMinified($template);
+    }
 }

diff -Nuar a/vendor/magento/framework/App/View/Deployment/Version.php b/vendor/magento/framework/App/View/Deployment/Version.php
--- a/vendor/magento/framework/App/View/Deployment/Version.php
+++ b/vendor/magento/framework/App/View/Deployment/Version.php
@@ -6,6 +6,10 @@

 namespace Magento\Framework\App\View\Deployment;

+use Magento\Framework\App\DeploymentConfig;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Config\ConfigOptionsListConstants;
+
 /**
  * Deployment version of static files
  */
@@ -27,15 +31,23 @@ class Version
     private $cachedValue;

     /**
+     * @var DeploymentConfig
+     */
+    private $deploymentConfig;
+
+    /**
      * @param \Magento\Framework\App\State $appState
      * @param Version\StorageInterface $versionStorage
+     * @param DeploymentConfig|null $deploymentConfig
      */
     public function __construct(
         \Magento\Framework\App\State $appState,
-        \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
+        \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
+        DeploymentConfig $deploymentConfig = null
     ) {
         $this->appState = $appState;
         $this->versionStorage = $versionStorage;
+        $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
     }

     /**
@@ -74,7 +86,17 @@ class Version
                 break;

             default:
-                $result = $this->versionStorage->load();
+                try {
+                    $result = $this->versionStorage->load();
+                } catch (\UnexpectedValueException $e) {
+                    if (!$this->deploymentConfig->getConfigData(
+                        ConfigOptionsListConstants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION
+                    )) {
+                        throw $e;
+                    }
+                    $result = (new \DateTime())->getTimestamp();
+                    $this->versionStorage->save($result);
+                }
         }
         return $result;
     }
