Skip to content
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

Add support for HTML injection #1817

Merged
merged 2 commits into from
Jan 22, 2017
Merged

Add support for HTML injection #1817

merged 2 commits into from
Jan 22, 2017

Conversation

QWp6t
Copy link
Member

@QWp6t QWp6t commented Jan 20, 2017

Resolves #1816

@@ -18,6 +18,7 @@ module.exports = {
target: config.devUrl,
proxyUrl: config.proxyUrl,
watch: config.watch,
delay: 500,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case you're editing a file that causes a refresh and you save the file multiple times, there's the possibility that you get an outdated version if the browser is in the middle of a refresh when the save is detected.

I ran into this and used reloadDebounce instead. Seems pointless to trigger multiple refreshes in a row anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delay is an arbitrary one set by my plugin to invoke a delay between local file system updates and injection/reload by BrowserSync. This is to resolve an issue with BrowserSync reloading before the server (i.e., VM) has synchronized with local file changes. My plugin by default has this value set to 50ms, but it's 500ms in Sage because I'm assuming that most developers are using a VM.

Anyway, I could add a separate option for debounce as well, or possibly refactor my current implementation to use debounce instead. I'll look into it and do some tests.

@QWp6t QWp6t merged commit de3bce9 into master Jan 22, 2017
@QWp6t QWp6t deleted the html-injection branch January 22, 2017 00:34
@QWp6t
Copy link
Member Author

QWp6t commented Jan 22, 2017

@oxyc I added a debounce option to the plugin so you can set debounce in webpack.config.watch.js if you want, and it will get passed as the value to reloadDebounce. I might wind up implementing my own debounce as well to handle the different ways of resolving file update events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants