From c935a845c4be38ff3cb88afabc06ba197bb23d86 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Tue, 30 Mar 2021 00:24:04 +0800 Subject: [PATCH 01/12] Add live reload for ignore attribute --- packages/core/src/Site/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index 40d0d956ca..0c55c63b92 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -846,7 +846,13 @@ class Site { async reloadSiteConfig() { const oldAddressablePages = this.addressablePages.slice(); const oldPagesSrc = oldAddressablePages.map(page => page.src); + const oldIgnore = this.siteConfig.ignore; await this.readSiteConfig(); + await this.handlePageReload(oldAddressablePages, oldPagesSrc); + await this.handleIgnoreReload(oldIgnore); + } + + async handlePageReload(oldAddressablePages, oldPagesSrc) { this.collectAddressablePages(); // Comparator for the _differenceWith comparison below @@ -889,6 +895,19 @@ class Site { }); } + async handleIgnoreReload(oldIgnore) { + const assetsToRemove = _.difference(this.siteConfig.ignore, oldIgnore); + const assetsToAdd = _.difference(oldIgnore, this.siteConfig.ignore); + + if (!_.isEmpty(assetsToRemove)) { + await this._removeMultipleAssets(assetsToRemove); + } + + if (!_.isEmpty(assetsToAdd)) { + await this._buildMultipleAssets(assetsToAdd); + } + } + /** * Checks if a specified file path is a dependency of a page * @param {string} filePath file path to check From 072a669cba425e03e3bc2bc32575952e862bb009 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Tue, 30 Mar 2021 18:18:29 +0800 Subject: [PATCH 02/12] Implement live reload for all attributes in site.json --- packages/core/src/Site/index.js | 66 ++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index 0c55c63b92..bac2fc2f2c 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -773,7 +773,7 @@ class Site { } async _rebuildSourceFiles() { - logger.info('Page added or removed, updating list of site\'s pages...'); + logger.info('Pages or site config modified, updating pages...'); this.beforeSiteGenerate(); this.layoutManager.removeLayouts(); @@ -844,15 +844,39 @@ class Site { } async reloadSiteConfig() { + const oldSiteConfig = this.siteConfig; const oldAddressablePages = this.addressablePages.slice(); const oldPagesSrc = oldAddressablePages.map(page => page.src); - const oldIgnore = this.siteConfig.ignore; await this.readSiteConfig(); - await this.handlePageReload(oldAddressablePages, oldPagesSrc); - await this.handleIgnoreReload(oldIgnore); + await this.handleIgnoreReload(oldSiteConfig.ignore); + await this.handlePageReload(oldAddressablePages, oldPagesSrc, this.isGlobalConfigModified(oldSiteConfig)); + await this.handleStyleReload(oldSiteConfig.style); } - async handlePageReload(oldAddressablePages, oldPagesSrc) { + /** + * Checks if any of the global attributes of site.json is modified + */ + isGlobalConfigModified(oldSiteConfig) { + return !_.isEqual(oldSiteConfig.faviconPath, this.siteConfig.faviconPath) + || !_.isEqual(oldSiteConfig.titlePrefix, this.siteConfig.titlePrefix) + || !_.isEqual(oldSiteConfig.style, this.siteConfig.style) + || !_.isEqual(oldSiteConfig.externalScripts, this.siteConfig.externalScripts) + || !_.isEqual(oldSiteConfig.globalOverride, this.siteConfig.globalOverride) + || !_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore) + || !_.isEqual(oldSiteConfig.plugins, this.siteConfig.plugins) + || !_.isEqual(oldSiteConfig.pluginsContext, this.siteConfig.pluginsContext) + || !_.isEqual(oldSiteConfig.headingIndexingLevel, this.siteConfig.headingIndexingLevel) + || !_.isEqual(oldSiteConfig.enableSearch, this.siteConfig.enableSearch) + || !_.isEqual(oldSiteConfig.disableHtmlBeautify, this.siteConfig.disableHtmlBeautify) + || !_.isEqual(oldSiteConfig.timeZone, this.siteConfig.timeZone) + || !_.isEqual(oldSiteConfig.locale, this.siteConfig.locale) + || !_.isEqual(oldSiteConfig.intrasiteLinkValidation, this.siteConfig.intrasiteLinkValidation); + } + + /** + * Handles the rebuilding of modified pages + */ + async handlePageReload(oldAddressablePages, oldPagesSrc, shouldRebuildAllPages) { this.collectAddressablePages(); // Comparator for the _differenceWith comparison below @@ -862,7 +886,7 @@ class Site { const removedPages = _.differenceWith(oldAddressablePages, this.addressablePages, isNewPage) .map(filePath => Site.setExtension(filePath.src, '.html')); - if (!_.isEmpty(addedPages) || !_.isEmpty(removedPages)) { + if (shouldRebuildAllPages || !_.isEmpty(addedPages) || !_.isEmpty(removedPages)) { await this.removeAsset(removedPages); await this._rebuildSourceFiles(); await this.writeSiteData(); @@ -895,16 +919,32 @@ class Site { }); } + /** + * Handles the reloading of ignore attributes + */ async handleIgnoreReload(oldIgnore) { - const assetsToRemove = _.difference(this.siteConfig.ignore, oldIgnore); - const assetsToAdd = _.difference(oldIgnore, this.siteConfig.ignore); - - if (!_.isEmpty(assetsToRemove)) { - await this._removeMultipleAssets(assetsToRemove); + const assetsToRemoved = _.difference(this.siteConfig.ignore, oldIgnore); + + if (!_.isEqual(oldIgnore, this.siteConfig.ignore)) { + await this._removeMultipleAssets(assetsToRemoved); + await this.buildAssets(); } + } + + /** + * Handles the reloading of the style attribute if it has been modified + */ + async handleStyleReload(oldStyle) { + if (!_.isEqual(oldStyle.bootstrapTheme, this.siteConfig.style.bootstrapTheme)) { + if (this.siteConfig.style.bootstrapTheme) { + await this.copyBootswatchTheme(); + } else { + const defaultBootstrapTheme = require.resolve('@markbind/core-web/asset/css/bootstrap.min.css'); + const themeDestPath = path.join(this.siteAssetsDestPath, 'css', 'bootstrap.min.css'); - if (!_.isEmpty(assetsToAdd)) { - await this._buildMultipleAssets(assetsToAdd); + await fs.copy(defaultBootstrapTheme, themeDestPath); + } + logger.info('Updated bootstrap theme'); } } From 15f5fd5b252a21e3255bc61a4be808010698dc0f Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Mon, 5 Apr 2021 11:35:29 +0800 Subject: [PATCH 03/12] Modify copyBootswatchTheme method to copy default theme during live reload of site.json --- packages/core/src/Site/index.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index bac2fc2f2c..1659606480 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -633,7 +633,7 @@ class Site { await this.buildAssets(); await (this.onePagePath ? this.lazyBuildSourceFiles() : this.buildSourceFiles()); await this.copyCoreWebAsset(); - await this.copyBootswatchTheme(); + await this.copyBootstrapTheme(false); await this.copyFontAwesomeAsset(); await this.copyOcticonsAsset(); await this.writeSiteData(); @@ -923,10 +923,10 @@ class Site { * Handles the reloading of ignore attributes */ async handleIgnoreReload(oldIgnore) { - const assetsToRemoved = _.difference(this.siteConfig.ignore, oldIgnore); + const assetsToRemove = _.difference(this.siteConfig.ignore, oldIgnore); if (!_.isEqual(oldIgnore, this.siteConfig.ignore)) { - await this._removeMultipleAssets(assetsToRemoved); + await this._removeMultipleAssets(assetsToRemove); await this.buildAssets(); } } @@ -936,14 +936,7 @@ class Site { */ async handleStyleReload(oldStyle) { if (!_.isEqual(oldStyle.bootstrapTheme, this.siteConfig.style.bootstrapTheme)) { - if (this.siteConfig.style.bootstrapTheme) { - await this.copyBootswatchTheme(); - } else { - const defaultBootstrapTheme = require.resolve('@markbind/core-web/asset/css/bootstrap.min.css'); - const themeDestPath = path.join(this.siteAssetsDestPath, 'css', 'bootstrap.min.css'); - - await fs.copy(defaultBootstrapTheme, themeDestPath); - } + await this.copyBootstrapTheme(true); logger.info('Updated bootstrap theme'); } } @@ -1282,15 +1275,18 @@ class Site { } /** - * Copies bootswatch theme to the assets folder if a valid theme is specified + * Copies bootstrap theme to the assets folder if a valid theme is specified + * @param {Boolean} toCopyDefault bootstrap theme to the assets folder */ - copyBootswatchTheme() { + copyBootstrapTheme(toCopyDefault) { const { theme } = this.siteConfig; - if (!theme || !_.has(SUPPORTED_THEMES_PATHS, theme)) { + if (!toCopyDefault && (!theme || !_.has(SUPPORTED_THEMES_PATHS, theme))) { return _.noop; } - const themeSrcPath = SUPPORTED_THEMES_PATHS[theme]; + const themeSrcPath = toCopyDefault && !theme + ? require.resolve('@markbind/core-web/asset/css/bootstrap.min.css') + : SUPPORTED_THEMES_PATHS[theme]; const themeDestPath = path.join(this.siteAssetsDestPath, 'css', 'bootstrap.min.css'); return fs.copy(themeSrcPath, themeDestPath); From 7dba59da1cac8a66ff15a3881e990081d7769af1 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Mon, 5 Apr 2021 16:06:47 +0800 Subject: [PATCH 04/12] Update after review --- packages/core/src/Site/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index 1659606480..b40decc34e 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -1276,15 +1276,18 @@ class Site { /** * Copies bootstrap theme to the assets folder if a valid theme is specified - * @param {Boolean} toCopyDefault bootstrap theme to the assets folder + * @param {Boolean} isRebuild only true if it is a rebuild */ - copyBootstrapTheme(toCopyDefault) { + copyBootstrapTheme(isRebuild) { const { theme } = this.siteConfig; - if (!toCopyDefault && (!theme || !_.has(SUPPORTED_THEMES_PATHS, theme))) { + + // If is it the initial build using the default theme or if the theme specified + // is not valid, then do nothing. + if ((!isRebuild && !theme) || (theme && !_.has(SUPPORTED_THEMES_PATHS, theme))) { return _.noop; } - const themeSrcPath = toCopyDefault && !theme + const themeSrcPath = !theme ? require.resolve('@markbind/core-web/asset/css/bootstrap.min.css') : SUPPORTED_THEMES_PATHS[theme]; const themeDestPath = path.join(this.siteAssetsDestPath, 'css', 'bootstrap.min.css'); From 3cd5628798e86a159e4661946e604e438941b9a4 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Mon, 5 Apr 2021 16:10:23 +0800 Subject: [PATCH 05/12] Update comment --- packages/core/src/Site/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index b40decc34e..63acb494eb 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -1281,7 +1281,7 @@ class Site { copyBootstrapTheme(isRebuild) { const { theme } = this.siteConfig; - // If is it the initial build using the default theme or if the theme specified + // If it is the initial build using the default theme or if the theme specified // is not valid, then do nothing. if ((!isRebuild && !theme) || (theme && !_.has(SUPPORTED_THEMES_PATHS, theme))) { return _.noop; From 4de7de58360d4816addd9c528b64c69fbc2f3c9a Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Tue, 6 Apr 2021 17:35:14 +0800 Subject: [PATCH 06/12] Update after review --- docs/userGuide/siteJsonFile.md | 4 ++++ packages/core/src/Site/index.js | 36 ++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/docs/userGuide/siteJsonFile.md b/docs/userGuide/siteJsonFile.md index e11643633b..b949650b8c 100644 --- a/docs/userGuide/siteJsonFile.md +++ b/docs/userGuide/siteJsonFile.md @@ -81,6 +81,10 @@ Here is a typical `site.json` file: + + +Note: `baseUrl` does not support live reload as it should not change in `markbind serve` mode. + #### **`faviconPath`** diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index 63acb494eb..c35bc45465 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -540,6 +540,13 @@ class Site { this.baseUrlMap = new Set(candidates.map(candidate => path.dirname(candidate))); this.variableProcessor = new VariableProcessor(this.rootPath, this.baseUrlMap); + this.buildManagers(); + } + + /** + * Set up the managers used with the configurations. + */ + buildManagers() { const config = { baseUrlMap: this.baseUrlMap, baseUrl: this.siteConfig.baseUrl, @@ -848,8 +855,9 @@ class Site { const oldAddressablePages = this.addressablePages.slice(); const oldPagesSrc = oldAddressablePages.map(page => page.src); await this.readSiteConfig(); - await this.handleIgnoreReload(oldSiteConfig.ignore); - await this.handlePageReload(oldAddressablePages, oldPagesSrc, this.isGlobalConfigModified(oldSiteConfig)); + await this.handleIgnoreReload(oldSiteConfig); + await this.handlePageReload(oldAddressablePages, oldPagesSrc, + oldSiteConfig, this.isGlobalConfigModified(oldSiteConfig)); await this.handleStyleReload(oldSiteConfig.style); } @@ -862,7 +870,6 @@ class Site { || !_.isEqual(oldSiteConfig.style, this.siteConfig.style) || !_.isEqual(oldSiteConfig.externalScripts, this.siteConfig.externalScripts) || !_.isEqual(oldSiteConfig.globalOverride, this.siteConfig.globalOverride) - || !_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore) || !_.isEqual(oldSiteConfig.plugins, this.siteConfig.plugins) || !_.isEqual(oldSiteConfig.pluginsContext, this.siteConfig.pluginsContext) || !_.isEqual(oldSiteConfig.headingIndexingLevel, this.siteConfig.headingIndexingLevel) @@ -876,7 +883,7 @@ class Site { /** * Handles the rebuilding of modified pages */ - async handlePageReload(oldAddressablePages, oldPagesSrc, shouldRebuildAllPages) { + async handlePageReload(oldAddressablePages, oldPagesSrc, oldSiteConfig, shouldRebuildAllPages) { this.collectAddressablePages(); // Comparator for the _differenceWith comparison below @@ -888,6 +895,7 @@ class Site { if (shouldRebuildAllPages || !_.isEmpty(addedPages) || !_.isEmpty(removedPages)) { await this.removeAsset(removedPages); + this.rebuildManagers(oldSiteConfig); await this._rebuildSourceFiles(); await this.writeSiteData(); } else { @@ -922,15 +930,29 @@ class Site { /** * Handles the reloading of ignore attributes */ - async handleIgnoreReload(oldIgnore) { - const assetsToRemove = _.difference(this.siteConfig.ignore, oldIgnore); + async handleIgnoreReload(oldSiteConfig) { + const assetsToRemove = _.difference(this.siteConfig.ignore, oldSiteConfig.ignore); - if (!_.isEqual(oldIgnore, this.siteConfig.ignore)) { + if (!_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore)) { await this._removeMultipleAssets(assetsToRemove); + this.rebuildManagers(oldSiteConfig); await this.buildAssets(); } } + /** + * Chceks the relevant site configurations for changes and rebuild managers if necessary + */ + rebuildManagers(oldSiteConfig) { + if (!_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore) + || !_.isEqual(oldSiteConfig.plugins, this.siteConfig.plugins) + || !_.isEqual(oldSiteConfig.pluginsContext, this.siteConfig.pluginsContext) + || !_.isEqual(oldSiteConfig.disableHtmlBeautify, this.siteConfig.disableHtmlBeautify) + || !_.isEqual(oldSiteConfig.intrasiteLinkValidation, this.siteConfig.intrasiteLinkValidation)) { + this.buildManagers(); + } + } + /** * Handles the reloading of the style attribute if it has been modified */ From 2a336607acd6d41fd72a66ccab00f6487e430d45 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Tue, 6 Apr 2021 22:46:39 +0800 Subject: [PATCH 07/12] Update after review --- packages/core/src/Site/index.js | 58 ++++++++++++--------------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index c35bc45465..c105e366ca 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -856,16 +856,25 @@ class Site { const oldPagesSrc = oldAddressablePages.map(page => page.src); await this.readSiteConfig(); await this.handleIgnoreReload(oldSiteConfig); - await this.handlePageReload(oldAddressablePages, oldPagesSrc, - oldSiteConfig, this.isGlobalConfigModified(oldSiteConfig)); + await this.handlePageReload(oldAddressablePages, oldPagesSrc, oldSiteConfig); await this.handleStyleReload(oldSiteConfig.style); } /** - * Checks if any of the global attributes of site.json is modified + * Handles the rebuilding of modified pages */ - isGlobalConfigModified(oldSiteConfig) { - return !_.isEqual(oldSiteConfig.faviconPath, this.siteConfig.faviconPath) + async handlePageReload(oldAddressablePages, oldPagesSrc, oldSiteConfig) { + this.collectAddressablePages(); + + // Comparator for the _differenceWith comparison below + const isNewPage = (newPage, oldPage) => _.isEqual(newPage, oldPage) || newPage.src === oldPage.src; + + const addedPages = _.differenceWith(this.addressablePages, oldAddressablePages, isNewPage); + const removedPages = _.differenceWith(oldAddressablePages, this.addressablePages, isNewPage) + .map(filePath => Site.setExtension(filePath.src, '.html')); + + // Checks if any attributes of site.json requiring a global rebuild are modified + const isGlobalConfigModified = () => !_.isEqual(oldSiteConfig.faviconPath, this.siteConfig.faviconPath) || !_.isEqual(oldSiteConfig.titlePrefix, this.siteConfig.titlePrefix) || !_.isEqual(oldSiteConfig.style, this.siteConfig.style) || !_.isEqual(oldSiteConfig.externalScripts, this.siteConfig.externalScripts) @@ -878,24 +887,10 @@ class Site { || !_.isEqual(oldSiteConfig.timeZone, this.siteConfig.timeZone) || !_.isEqual(oldSiteConfig.locale, this.siteConfig.locale) || !_.isEqual(oldSiteConfig.intrasiteLinkValidation, this.siteConfig.intrasiteLinkValidation); - } - - /** - * Handles the rebuilding of modified pages - */ - async handlePageReload(oldAddressablePages, oldPagesSrc, oldSiteConfig, shouldRebuildAllPages) { - this.collectAddressablePages(); - // Comparator for the _differenceWith comparison below - const isNewPage = (newPage, oldPage) => _.isEqual(newPage, oldPage) || newPage.src === oldPage.src; - - const addedPages = _.differenceWith(this.addressablePages, oldAddressablePages, isNewPage); - const removedPages = _.differenceWith(oldAddressablePages, this.addressablePages, isNewPage) - .map(filePath => Site.setExtension(filePath.src, '.html')); - - if (shouldRebuildAllPages || !_.isEmpty(addedPages) || !_.isEmpty(removedPages)) { + if (isGlobalConfigModified() || !_.isEmpty(addedPages) || !_.isEmpty(removedPages)) { await this.removeAsset(removedPages); - this.rebuildManagers(oldSiteConfig); + this.buildManagers(); await this._rebuildSourceFiles(); await this.writeSiteData(); } else { @@ -930,26 +925,13 @@ class Site { /** * Handles the reloading of ignore attributes */ - async handleIgnoreReload(oldSiteConfig) { - const assetsToRemove = _.difference(this.siteConfig.ignore, oldSiteConfig.ignore); + async handleIgnoreReload(oldIgnore) { + const assetsToRemove = _.difference(this.siteConfig.ignore, oldIgnore); - if (!_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore)) { + if (!_.isEqual(oldIgnore, this.siteConfig.ignore)) { await this._removeMultipleAssets(assetsToRemove); - this.rebuildManagers(oldSiteConfig); - await this.buildAssets(); - } - } - - /** - * Chceks the relevant site configurations for changes and rebuild managers if necessary - */ - rebuildManagers(oldSiteConfig) { - if (!_.isEqual(oldSiteConfig.ignore, this.siteConfig.ignore) - || !_.isEqual(oldSiteConfig.plugins, this.siteConfig.plugins) - || !_.isEqual(oldSiteConfig.pluginsContext, this.siteConfig.pluginsContext) - || !_.isEqual(oldSiteConfig.disableHtmlBeautify, this.siteConfig.disableHtmlBeautify) - || !_.isEqual(oldSiteConfig.intrasiteLinkValidation, this.siteConfig.intrasiteLinkValidation)) { this.buildManagers(); + await this.buildAssets(); } } From a4b3a7a01c3aff72c3d620b2bf896da322bdf85c Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Tue, 6 Apr 2021 22:54:01 +0800 Subject: [PATCH 08/12] Fix paramter for handleIgnore --- packages/core/src/Site/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index c105e366ca..a70acbcb44 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -855,7 +855,7 @@ class Site { const oldAddressablePages = this.addressablePages.slice(); const oldPagesSrc = oldAddressablePages.map(page => page.src); await this.readSiteConfig(); - await this.handleIgnoreReload(oldSiteConfig); + await this.handleIgnoreReload(oldSiteConfig.ignore); await this.handlePageReload(oldAddressablePages, oldPagesSrc, oldSiteConfig); await this.handleStyleReload(oldSiteConfig.style); } From d0d7da22c6b303e0643c77f3326f4efead3439fc Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Wed, 7 Apr 2021 18:36:18 +0800 Subject: [PATCH 09/12] Update after review --- docs/userGuide/glossary.md | 3 +++ docs/userGuide/siteJsonFile.md | 4 +++- packages/core/src/Site/index.js | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/userGuide/glossary.md b/docs/userGuide/glossary.md index f6e9234b1b..4ffa2b6d03 100644 --- a/docs/userGuide/glossary.md +++ b/docs/userGuide/glossary.md @@ -10,10 +10,13 @@ **_Live preview_** is: - Regeneration of affected content upon any change to source files, then reloading the updated site in the Browser. +- Regeneration will also occur upon any modification to attributes in `site.json` with the exception of [`baseUrl`](siteJsonFile.md#baseurl-no-live-preview). + - Copying assets to the site output folder. Use [the `serve` command](cliCommands.html#serve-command) to launch a live preview. +
diff --git a/docs/userGuide/siteJsonFile.md b/docs/userGuide/siteJsonFile.md index b949650b8c..2c9800552c 100644 --- a/docs/userGuide/siteJsonFile.md +++ b/docs/userGuide/siteJsonFile.md @@ -81,10 +81,12 @@ Here is a typical `site.json` file: + -Note: `baseUrl` does not support live reload as it should not change in `markbind serve` mode. +Note: `baseUrl` does not support live preview as there is no use case for changing it in during `markbind serve`. + #### **`faviconPath`** diff --git a/packages/core/src/Site/index.js b/packages/core/src/Site/index.js index a70acbcb44..f12773bd06 100644 --- a/packages/core/src/Site/index.js +++ b/packages/core/src/Site/index.js @@ -1285,8 +1285,10 @@ class Site { copyBootstrapTheme(isRebuild) { const { theme } = this.siteConfig; - // If it is the initial build using the default theme or if the theme specified - // is not valid, then do nothing. + /** + * If it is the initial build using the default theme or if the theme specified + * is not valid, then do nothing. + */ if ((!isRebuild && !theme) || (theme && !_.has(SUPPORTED_THEMES_PATHS, theme))) { return _.noop; } From c20a5b3a4c7f338381edf19d4d6ccedabce1aeda Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Wed, 7 Apr 2021 18:44:09 +0800 Subject: [PATCH 10/12] Update definition of live preview --- docs/userGuide/glossary.md | 2 -- docs/userGuide/siteJsonFile.md | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/userGuide/glossary.md b/docs/userGuide/glossary.md index 4ffa2b6d03..9284f346b5 100644 --- a/docs/userGuide/glossary.md +++ b/docs/userGuide/glossary.md @@ -10,8 +10,6 @@ **_Live preview_** is: - Regeneration of affected content upon any change to source files, then reloading the updated site in the Browser. -- Regeneration will also occur upon any modification to attributes in `site.json` with the exception of [`baseUrl`](siteJsonFile.md#baseurl-no-live-preview). - - Copying assets to the site output folder. Use [the `serve` command](cliCommands.html#serve-command) to launch a live preview. diff --git a/docs/userGuide/siteJsonFile.md b/docs/userGuide/siteJsonFile.md index 2c9800552c..e3b728822a 100644 --- a/docs/userGuide/siteJsonFile.md +++ b/docs/userGuide/siteJsonFile.md @@ -81,12 +81,10 @@ Here is a typical `site.json` file: - -Note: `baseUrl` does not support live preview as there is no use case for changing it in during `markbind serve`. +Note: `baseUrl` does not support [live preview](glossary.md#live-preview) as there is no use case for changing it in during `markbind serve`. - #### **`faviconPath`** From b51eca3cc3483c6f1b1ca93f0c7fd506154bf0e5 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Wed, 7 Apr 2021 18:46:35 +0800 Subject: [PATCH 11/12] Remove empty line --- docs/userGuide/glossary.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/userGuide/glossary.md b/docs/userGuide/glossary.md index 9284f346b5..f6e9234b1b 100644 --- a/docs/userGuide/glossary.md +++ b/docs/userGuide/glossary.md @@ -14,7 +14,6 @@ Use [the `serve` command](cliCommands.html#serve-command) to launch a live preview. -
From 7052df0dfc038ee6ba5e2c68e85058f535f89ac2 Mon Sep 17 00:00:00 2001 From: jonahtanjz Date: Sat, 10 Apr 2021 13:39:41 +0800 Subject: [PATCH 12/12] Add site.json live preview in glossary --- docs/userGuide/glossary.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/userGuide/glossary.md b/docs/userGuide/glossary.md index f6e9234b1b..f1d506140b 100644 --- a/docs/userGuide/glossary.md +++ b/docs/userGuide/glossary.md @@ -10,6 +10,8 @@ **_Live preview_** is: - Regeneration of affected content upon any change to source files, then reloading the updated site in the Browser. +- Regeneration will also occur upon any modification to attributes in `site.json` with the exception of [`baseUrl`](siteJsonFile.md#baseurl). + - Copying assets to the site output folder. Use [the `serve` command](cliCommands.html#serve-command) to launch a live preview.