diff -Nuar a/vendor/magento/framework/App/StaticResource.php b/vendor/magento/framework/App/StaticResource.php
--- a/vendor/magento/framework/App/StaticResource.php
+++ b/vendor/magento/framework/App/StaticResource.php
@@ -8,6 +8,7 @@ namespace Magento\Framework\App;
 use Magento\Framework\App\Filesystem\DirectoryList;
 use Magento\Framework\ObjectManager\ConfigLoaderInterface;
 use Magento\Framework\Filesystem;
+use Magento\Framework\Config\ConfigOptionsListConstants;
 use Psr\Log\LoggerInterface;

 /**
@@ -63,6 +64,11 @@ class StaticResource implements \Magento\Framework\AppInterface
     private $filesystem;

     /**
+     * @var DeploymentConfig
+     */
+    private $deploymentConfig;
+
+    /**
      * @var \Psr\Log\LoggerInterface
      */
     private $logger;
@@ -76,6 +82,7 @@ class StaticResource implements \Magento\Framework\AppInterface
      * @param \Magento\Framework\Module\ModuleList $moduleList
      * @param \Magento\Framework\ObjectManagerInterface $objectManager
      * @param ConfigLoaderInterface $configLoader
+     * @param DeploymentConfig|null $deploymentConfig
      */
     public function __construct(
         State $state,
@@ -85,7 +92,8 @@ class StaticResource implements \Magento\Framework\AppInterface
         \Magento\Framework\View\Asset\Repository $assetRepo,
         \Magento\Framework\Module\ModuleList $moduleList,
         \Magento\Framework\ObjectManagerInterface $objectManager,
-        ConfigLoaderInterface $configLoader
+        ConfigLoaderInterface $configLoader,
+        DeploymentConfig $deploymentConfig = null
     ) {
         $this->state = $state;
         $this->response = $response;
@@ -95,6 +103,7 @@ class StaticResource implements \Magento\Framework\AppInterface
         $this->moduleList = $moduleList;
         $this->objectManager = $objectManager;
         $this->configLoader = $configLoader;
+        $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
     }

     /**
@@ -108,7 +117,11 @@ class StaticResource implements \Magento\Framework\AppInterface
         // disabling profiling when retrieving static resource
         \Magento\Framework\Profiler::reset();
         $appMode = $this->state->getMode();
-        if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
+        if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION
+            && !$this->deploymentConfig->getConfigData(
+                ConfigOptionsListConstants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION
+            )
+        ) {
             $this->response->setHttpResponseCode(404);
         } else {
             $path = $this->request->get('resource');

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,9 @@

 namespace Magento\Framework\App\View\Deployment;

+use Magento\Framework\App\DeploymentConfig;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Config\ConfigOptionsListConstants;
 use Psr\Log\LoggerInterface;

 /**
@@ -34,15 +37,23 @@ class Version
     private $logger;

     /**
+     * @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);
     }

     /**
@@ -68,7 +79,11 @@ class Version
     {
         $result = $this->versionStorage->load();
         if (!$result) {
-            if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
+            if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION
+                && !$this->deploymentConfig->getConfigData(
+                    ConfigOptionsListConstants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION
+                )
+            ) {
                 $this->getLogger()->critical('Can not load static content version.');
                 throw new \UnexpectedValueException(
                     "Unable to retrieve deployment version of static files from the file system."

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
@@ -36,6 +36,7 @@ class ConfigOptionsListConstants
     const CONFIG_PATH_DB_LOGGER_LOG_EVERYTHING = 'db_logger/log_everything';
     const CONFIG_PATH_DB_LOGGER_QUERY_TIME_THRESHOLD = 'db_logger/query_time_threshold';
     const CONFIG_PATH_DB_LOGGER_INCLUDE_STACKTRACE = 'db_logger/include_stacktrace';
+    const CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION = 'static_content_on_demand_in_production';
     /**#@-*/

     /**#@+

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);
+    }
 }
