-
Notifications
You must be signed in to change notification settings - Fork 142
Add a --force-reload flag to markbind serve #424
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
Conversation
|
Hi @acjh, I've looked through the two comment threads and sorry, but could you explain a little more about what changes I should make? My rationale for changing the delay function was to add an extra parameter What I gathered from the first thread was that the old definition of delay adds a Which is necessary for cases like But this seems strange to me because I expected delay to be a wrapper function that can be used with any Regarding the use of For example: |
|
If I recall correctly, your change would cause this: pendingArgs = [];
// ...
pendingArgs = [filePaths, forceReload];
// ...
pendingArgs = [filePaths, forceReload, filePaths, forceReload];Did you test? |
209db74 to
59c7317
Compare
|
Ah I see... I didn't know delay aggregated the params and executed them all at once, I thought it was just a simple delay function, my bad. I moved the forceReload param to the Site constructor, I think that might be simpler for now. |
docs/userGuide/userQuickStart.md
Outdated
| |---|---| | ||
| | `-p`, `--port <port>` | The port used for serving your website. | | ||
| | --no-open | Don't open browser automatically. | | ||
| | --force-reload | Forces a full reload of all site files when a file is changed. | |
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.
How about a -f short flag? If yes, move above -p, else move above --no-open.
index.js
Outdated
| .description('build then serve a website from a directory') | ||
| .option('-p, --port <port>', 'port for server to listen on (Default is 8080)') | ||
| .option('--no-open', 'do not automatically open the site in browser') | ||
| .option('--force-reload', 'forces a full reload of all site files when a file is changed') |
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.
"forcesforce a full reload ..." — let's use imperative mood.
lib/Site.js
Outdated
| this.baseUrlMap = {}; | ||
| this.siteConfig = {}; | ||
| this.userDefinedVariablesMap = {}; | ||
| this.forceReload = forceReload; |
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.
Alphabetical order.
lib/Site.js
Outdated
|
|
||
| Site.prototype._rebuildAffectedSourceFiles = function (filePaths) { | ||
| const uniquePaths = _.uniq(filePaths); | ||
| const wrappedFilepaths = Array.isArray(filePaths) ? filePaths : [filePaths]; |
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.
wrappedseems like an odd way to describe an "ensuring an array", but I don't have a better name at the moment.- We should not lose the capital
Pfor consistency.
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.
How about just filePathArray?
It was named after Promise.delay, but we can rename if there is a better name used by other libraries.
Remember to update PR description. |
|
I see, thanks for the information |
|
@jamos-tay this feature doesn't seem to be reloading nunjucks code though :-( |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] New feature
Fixes #403
What is the rationale for this request?
Changing certain files will not trigger a rebuild. User might want a way to force a rebuild of all files.
What changes did you make? (Give an overview)
Add a
--force-reloadflag tomarkbind serveto allow user to rebuild all files whenever a file is changed.When set, any change detected in the directory will immediately trigger a rebuild of all files.