-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement lazy page building for markbind serve #1038
Conversation
This can really help improve QoL of authors, if the eventually makes it to the production version. 👍 |
Would the caveat of search results being incorrect be an acceptable compromise? The problem would be exacerbated if the extension is implemented as well ( in this case the ( that said, the author could still use the sitenav and pagenav when writing pages to navigate around quickly ) |
|
Yup, the current flag I used is We could document this as a feature for "extremely large sites", where the benefits of build times would outweigh the compromise in search results.
Hmm, I might have misunderstood what you meant, but dosen't Along those lines I think its definitely feasible to pass a flag to |
77b338c
to
03aa0db
Compare
I think missing search results is an acceptable compromise as long as the user is told about it and as long as there is a way to opt out of lazy live loading. |
Combining it is definitely feasible, and removing it should be problem free as well since the implementation is rather "independent". Personally, I prefer removing it, though it may be helpful to "start the lazy mode" on a particular page to hasten things a little. |
Is it possible to make it like this? |
Should be possible, though just to clarify, I'll go with the existing |
Yes. The other question to ask is whether lazy live loading should be the default (i.e., we provide a flag to opt out of it). |
I think it should be optionally activated through
A small thing:
|
Sure, that works.
I think we should show spinner, but open to other suggestions. |
f65bbd1
to
274a57d
Compare
bde1dd3
to
610be36
Compare
Ready for review
I've changed it to show the spinner, which I think is better as well. |
769e8ad
to
1e3de91
Compare
Updated on latest master with small fix for file addition / deletion Will comment again if there are changes / conflicts while keeping this updated |
a75de0e
to
49e33e2
Compare
1e9f302
to
7357f9b
Compare
index.js
Outdated
next(); | ||
}; | ||
|
||
serverConfig.middleware = [lazyReloadMiddleware]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize an empty array for middleware
during the initialization of serverConfig
, then replace this with a push instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated; Thanks for looking through this!
During live reload, changes to a source file rebuilds all files that are dependent on it. In addition, rebuilding all dependent source files slows the live reload process, leading to a less pleasant user experience. In addition, when running markbind serve, all pages are built and rendered initially. This significantly slows down the time to first page load, which can be substantial when the number of source files is huge. Let's implement lazy page building in these operations, which is opt-in using the existing -o <file> or --one-page <file> flags for the markbind serve command. Changes to a source file will only rebuild pages that are dependent on it, and is currently being viewed by the author. Other pages not being viewed by the author are rebuilt when the author navigates to them. In addition, only the landing page is built initially when serving. Subsequent pages are built when the author navigates to them.
7357f9b
to
c2e3d45
Compare
* 'master' of https://github.com/MarkBind/markbind: 2.12.0 Update outdated test files Update vue-strap version to v2.0.1-markbind.37 Fix refactor to processDynamicResources (MarkBind#1092) Implement lazy page building for markbind serve (MarkBind#1038) Add warnings for conflicting/deprecated component attribs (MarkBind#1057) Allow changing parameter properties (MarkBind#1075) Custom timezone for built-in timestamp (MarkBind#1073) Fix reload inconsistency when updating frontmatter (MarkBind#1068) Implement an api to ignore content in certain tags (MarkBind#1047) Enable AppVeyor CI (MarkBind#1040) Add heading and line highlighting to code blocks (MarkBind#1034) Add dividers and fix bug in siteNav (MarkBind#1063) Fixed navbar no longer covers modals (MarkBind#1070) Add copy code-block plugin (MarkBind#1043) Render plugins on dynamic resources (MarkBind#1051) Documentation for Implement no-* attributes for <box> (MarkBind#1042) Migrate to bootstrap-vue popovers (MarkBind#1033) Refactor preprocess and url processing functions (MarkBind#1026) Add pageNav to Using Plugins Page (MarkBind#1062)
This feature is great 👍 I'm going to use the |
During live reload, changes to a source file rebuilds all files that are dependent on it. In addition, rebuilding all dependent source files slows the live reload process, leading to a less pleasant user experience. In addition, when running markbind serve, all pages are built and rendered initially. This significantly slows down the time to first page load, which can be substantial when the number of source files is huge. Let's implement lazy page building in these operations, which is opt-in using the existing -o <file> or --one-page <file> flags for the markbind serve command. Changes to a source file will only rebuild pages that are dependent on it, and is currently being viewed by the author. Other pages not being viewed by the author are rebuilt when the author navigates to them. In addition, only the landing page is built initially when serving. Subsequent pages are built when the author navigates to them.
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [x] Enhancement to an existing feature
Resolves #1007
What is the rationale for this request?
To implement the following two things
Lazily building the initial
serve
Lazily rebuilding affected source files
Editing
text.md
of software engineering topic of 2103 website:Gifs are here to keep things lean: #1038 (comment)
The main caveat is that heading indexing for unbuilt / unrebuilt pages will not be run, causing fewer than expected search results to show up, until the user navigates to that page.
Hence, the possible search results are limited to the starting page at first, while slowly extending to all pages as the user navigates to them.
In the long run, the savings in rebuild times from rebuilding the page the user is working on only should greatly outweight the "extra time before serving the page".
What changes did you make? (Give an overview)
-o
option for lazy live reloading, which's behaviour is:site
instance:currentPageViewed
Provide some example code that this change will affect:
Is there anything you'd like reviewers to focus on?
na
Testing instructions:
markbind serve -o <file>
should build only the<file>
specified ( by default landing pageindex.md
if none ) and start the live server.<file>
should be "flagged" when initially runningmarkbind serve -o
.Proposed commit message: (wrap lines at 72 characters)
Implement lazy page building for markbind serve
During live reload, changes to a source file rebuilds all files that are
dependent on it.
In addition, rebuilding all dependent source files slows the live reload
process, leading to a less pleasant user experience.
In addition, when running markbind serve, all pages are built and
rendered initially.
This significantly slows down the time to first page load, which can
be substantial when the number of source files is huge.
Let's implement lazy page building in these operations, which is opt-in
using the existing -o or --one-page flags for the markbind
serve command.
Changes to a source file will only rebuild pages that are dependent on
it, and is currently being viewed by the author. Other pages not being
viewed by the author are rebuilt when the author navigates to them.
In addition, only the landing page is built initially when serving.
Subsequent pages are built when the author navigates to them.