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

Feature request: serveStatic (for-free passthroughCopy) #12

Closed
TigersWay opened this issue Mar 12, 2022 · 5 comments
Closed

Feature request: serveStatic (for-free passthroughCopy) #12

TigersWay opened this issue Mar 12, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@TigersWay
Copy link

I have been using - quite a lot - the serveStatic feature of browsersync.

Despite being "minimal", could this new server propose the same feature?
Of course it's still possible to use browsersync.

@zachleat zachleat added the enhancement New feature or request label Mar 14, 2022
@zachleat
Copy link
Member

Hmm, interesting idea!

https://browsersync.io/docs/options/#option-serveStatic

Has me thinking about the overlap between something like this and passthrough copy—specifically, we could expose passthrough copy directories as static dirs instead of requiring them to be copied to the output folder (during dev mode).

How else do you use this one?

@TigersWay
Copy link
Author

That's exactly how I use it!
We sometimes have quite heavy static folder(s), it seems a little pointless to copy all the files again and again.

@epelc
Copy link

epelc commented May 5, 2022

We would benefit from something like this too. Having to copy thousands of image files can be quite slow.

It'd be really nice if eleventy.addPassthroughCopy() had an option of not actually copying files during serve but only during build. ie just go check the source path for whatever wildcard is listed instead.

Having it support to existing api would be very helpful as older sites have a mix of directory layouts and do not have all your image/asset files in a nice top level folder.

@TigersWay
Copy link
Author

Thank to @zachleat and his answer to #13, I simply tried the serve-static middleware for expressjs and it's working fine!

  • It's then easy to swap from the [dev server & middleware] to [addPassthroughCopy] for production
  • There's just one problem left, we can't - simply - filter the requested path/resources as expressjs is doing with use

@zachleat zachleat changed the title Feature request: serveStatic Feature request: serveStatic (for-free passthroughCopy) Jun 17, 2022
zachleat added a commit to 11ty/eleventy that referenced this issue Jun 23, 2022
…e passthrough copy. Passthrough copy now no longer triggers a build during --serve or --watch. Instead, the Dev Server now serves these files directly from the project directory. Changes to passthrough copy files (despite skipping a build) *will* trigger a page reload in your browser.

Related to 11ty/eleventy-dev-server#12

Fixes #2456
@zachleat
Copy link
Member

For-free passthrough copy was filed on core at 11ty/eleventy#2456 will be shipping with Eleventy 2.0.0-canary.12!

Closing this one as resolved—the dev server piece of this shipped with 1.0.0-canary.11.

Thank you!

@zachleat zachleat added this to the v1.0.0 milestone Jun 23, 2022
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
None yet
Development

No branches or pull requests

3 participants