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

Replaced express.static with expressStaticGzip #144

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

je4ngomes
Copy link
Contributor

I needed to control my compressed files and the order in which they are served to the client. In this commit, I've replaced express.static with expressStaticGzip, which provides more options for customization and control over which compressed files to serve. Here is a functional example:

ViteExpress.static({
	enableBrotli: true,
	orderPreference: ['zstd', 'br', 'gz'],
	customCompressions: [{ encodingName: 'zstd', fileExtension: 'zst' }],
	index: false,
});

I'm using a temporary version I uploaded to npm (@je4ngomes/vite-express) to test this. In case this gets accepted it would be necessary to update the README.md file.

I appreciate you maintaining this package :)

@szymmis
Copy link
Owner

szymmis commented Aug 29, 2024

Hi @je4ngomes, thanks a lot for your contribution!

Replacing current implementation with another seems a little bit use-case specific to me, but I guess that expressStaticGzip is a wrapper on top of serve-static and has the same set of functionalities plus some more right? Because I don't want to replace it with something that has a little bit different use-cases.

@je4ngomes
Copy link
Contributor Author

Hi @szymmis, you’re correct, expressStaticGzip is a wrapper around serve-static and retains all of its core functionality. I would say the key benefits of expressStaticGzip are the added flexibility in handling compressed files and control over the order of preferred compression formats.

@je4ngomes
Copy link
Contributor Author

Hi @szymmis, you’re correct, expressStaticGzip is a wrapper around serve-static and retains all of its core functionality. I would say the key benefits of expressStaticGzip are the added flexibility in handling compressed files and control over the order of preferred compression formats.

But to avoid replacing anything, an option in the future could be to expose a way for us to specify our own method of serving static files.

@szymmis
Copy link
Owner

szymmis commented Aug 29, 2024

Thank you for the answer. I can see that the tests are passing, so I don't think there is nothing preventing us from releasing that change. I'll let you know as soon as the new version is available.

Thanks a lot for your contribution!

@szymmis szymmis merged commit c80f51c into szymmis:master Aug 29, 2024
1 check passed
@szymmis
Copy link
Owner

szymmis commented Aug 29, 2024

@je4ngomes, your changes are live on NPM in v0.19.0! 🚀
Once again, big thanks for spending your time and implementing this change!

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