JSRocksHQ / harmonic

The next static site generator
http://harmonicjs.com/
MIT License
283 stars 26 forks source link

Support browser-sync? #49

Closed UltCombo closed 9 years ago

UltCombo commented 10 years ago

I see @jaydson has been working on the watch branch which, as far as I can see, regenerates the whole site when files are edited.

I believe it'd be optimal if we could refresh the browser after the new files are generated.

As far as I know, BrowserSync is the simplest way to achieve this. It does not require any browser plugins nor any modification to the pages.

BrowserSync has 2 operation modes: it can create a static server or proxy an existing server. In either case, it will automatically inject the necessary scripts to communicate with Node.

In our case, I believe we could replace the node-static dependency with BrowserSync's static server, and in watch mode we just have to add browserSync.reload to the end of the site regenerating pipeline.

And if we replace node-static with browser-sync, it may as well be better to have watch mode enabled by default to keep the logic simple.

Thoughts?

UltCombo commented 10 years ago

Oh, and BrowserSync also comes with the excellent Gaze watcher bundled. Here's the BrowserSync API docs and configs.

jaydson commented 10 years ago

Hey @UltCombo , it seems that is an excellent option, indeed! Can you try to make a prototype in a separated branch?

UltCombo commented 10 years ago

@jaydson of course. =] I'll work on it later tonight.

jaydson commented 9 years ago

Did you had time to test it? This still a great feature :)

UltCombo commented 9 years ago

Oh my bad, I ended up without time to test it back then. This is still a great idea, I'll probably try to implement it this weekend. I intend to finish writing the TDZ post and publish a stable slush-es6 version ASAP, then I'll have time to go through these Harmonic issues.

jaydson commented 9 years ago

:+1:

UltCombo commented 9 years ago

I was about to propose a --no-cache/--dev flag to harmonic run to aid writing articles, but then I just realized that implementing browser-sync would make such feature redundant hah.

I still have some more stuff to do around other repositories, but once I get back to Harmonic (still this weekend), browser-sync will be a top priority.

UltCombo commented 9 years ago

I've imported the priority labels from JSHint, by the way.

jaydson commented 9 years ago

Thanks @UltCombo . The labels "good first bug" and "Proposal" are great, we can also use it.

UltCombo commented 9 years ago

@jaydson agreed, feel free to add them. =]

BTW, I haven't got to work on browser-sync implementation yet as I have some slightly late projects/tasks -- I said I'd help on gulp-jscs reporters about a month ago and just got to it now heh.

UltCombo commented 9 years ago

I believe we can deploy Harmonic 0.0.10 after implementing browser-sync, I guess this will be the main feature of the release then. It would be nice to have a changelog (#116) to know the releases' details.

jaydson commented 9 years ago

Seems good to me.

jaydson commented 9 years ago

UltCombo commented 9 years ago