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

Watching .css and .js files using browser sync #373

Merged
merged 7 commits into from
Aug 5, 2020

Conversation

esprush
Copy link
Member

@esprush esprush commented Aug 3, 2020

@manojVivek @jjavierdguezas hot reloading for local files using browserSync. added support for js,html and css.

await initInstance();
}
}

export function watchFiles(fileDir) {
filesWatcher = browserSyncEmbed
.watch([`${fileDir}/*.html`, `${fileDir}/**/**.js`])
Copy link
Contributor

Choose a reason for hiding this comment

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

@esprush
If we are watching all *.js and all *.css in all sub folders, why not to do the same with *.html?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jjavierdguezas made it this way since html might depend on css and js in subfolders.
whereas html file is always one which is selected in the address bar. so thought watching subfolders for html is not needed.

Copy link
Collaborator

@manojVivek manojVivek Aug 4, 2020

Choose a reason for hiding this comment

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

I think we should only watch the currently loaded .html file, as the other HTML files may not be related to the current page.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@esprush @jjavierdguezas Merging this now. Let's address any concerns in a new PR.

@@ -305,30 +307,19 @@ const createWindow = async () => {
onResize();
});

const watcher = new chokidar.FSWatcher();
Copy link
Contributor

Choose a reason for hiding this comment

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

should we uninstall chokidar package right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes @jjavierdguezas . removed

Copy link
Member Author

@esprush esprush left a comment

Choose a reason for hiding this comment

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

@manojVivek @jjavierdguezas made further updates

  1. watch only specific html file
  2. check if the file is valid.

@@ -305,30 +307,19 @@ const createWindow = async () => {
onResize();
});

const watcher = new chokidar.FSWatcher();
Copy link
Member Author

Choose a reason for hiding this comment

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

yes @jjavierdguezas . removed

await initInstance();
}
}

export function watchFiles(fileDir) {
filesWatcher = browserSyncEmbed
.watch([`${fileDir}/*.html`, `${fileDir}/**/**.js`])
Copy link
Member Author

Choose a reason for hiding this comment

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

@jjavierdguezas made it this way since html might depend on css and js in subfolders.
whereas html file is always one which is selected in the address bar. so thought watching subfolders for html is not needed.

@manojVivek manojVivek merged commit 584e710 into master Aug 5, 2020
@manojVivek manojVivek deleted the feature/file-watcher branch August 5, 2020 08:03
@manojVivek manojVivek added the enhancement New feature or request label Aug 6, 2020
@manojVivek manojVivek added this to the v0.10.0 milestone Aug 6, 2020
@manojVivek manojVivek added this to Ready for Release in App Roadmap Aug 6, 2020
@manojVivek manojVivek changed the title file watching using browser sync Watching .css and .js files using browser sync Aug 6, 2020
@manojVivek manojVivek moved this from Ready for Release to Release v0.10.0 in App Roadmap Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
App Roadmap
  
Release v0.10.0
Development

Successfully merging this pull request may close these issues.

None yet

3 participants