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

Create a named instance of the browser-sync server #1125

Closed
MaybeThisIsRu opened this issue Apr 27, 2020 · 6 comments
Closed

Create a named instance of the browser-sync server #1125

MaybeThisIsRu opened this issue Apr 27, 2020 · 6 comments

Comments

@MaybeThisIsRu
Copy link

Is your feature request related to a problem? Please describe.
I have a starter-kit geared towards eleventy. I was using my own browserSync server to get full control over when to trigger a reload (for example, after my css or img tasks finish). I recently switched to the internal browserSync server for various reasons - chief among them getting ready in anticipation of incremental builds.

eleventy is internally using browserSync as well and allows specifying options.
However, the instance created is not a named instance. It is therefore not possible for my tasks to look up if there is any active server and then hook into it.

Describe the solution you'd like
This should be a one line change here by passing a name string to the create() method.

https://github.com/11ty/eleventy/blob/master/src/EleventyServe.js#L119

This will then allow one to get the instance of the server and trigger page reloads when necessary.

I'll open a PR shortly.

Describe alternatives you've considered
I have looked through the browserSync options as suggested in the docs. It is not possible to configure a name of the server through options.

Additional context
I use gulp to create an asset pipeline and require the server to reload when my tasks finish. These tasks don't affect eleventy's built files.

@MaybeThisIsRu MaybeThisIsRu changed the title Create a named instance of the broswerSync server Create a named instance of the browser-sync server Apr 27, 2020
@Ryuno-Ki
Copy link
Contributor

Ryuno-Ki commented May 3, 2020

Do you have suggestions for the name? Are there limitations or considerations to take into account?

@MaybeThisIsRu
Copy link
Author

MaybeThisIsRu commented May 4, 2020

Do you have suggestions for the name?

The name can be anything, really - I've gone for eleventyServer in my PR.

Are there limitations or considerations to take into account?

Not that I'm aware of, sorry.

@MaybeThisIsRu
Copy link
Author

MaybeThisIsRu commented Jul 11, 2020

This seems redundant as a replacement server is being explored in #1305.

@MaybeThisIsRu
Copy link
Author

Sorry - reopened as it seems to be in preliminary stages. If and when a replacement is chosen, we can close this.

Either way, it's probably good to have linked to the issue so it is easily accessible in the context of the replacement.

@zachleat
Copy link
Member

Agree! This is a great addition—thank you! The named instance is eleventy-server

@zachleat zachleat added this to the Eleventy 1.0.0 milestone Nov 15, 2020
@zachleat
Copy link
Member

Fixed by #1126

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

No branches or pull requests

3 participants