-
-
Notifications
You must be signed in to change notification settings - Fork 54
feat: support pre-compressed-assets #100
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
base: master
Are you sure you want to change the base?
Conversation
|
WIP, haven't add test case. |
79b95ce to
767dd6c
Compare
|
I don't see how pre-compressed files can be served in hexo-server. I mean, most of the theme doesn't provide pre-compressed js & css. |
|
With a compression plugin like hexo-yam. How to test: package.json
- "hexo-server": "^1.0.0"
+ "hexo-server": "curbengh/hexo-server#pre-compressed",
+ "hexo-yam": "^3.1.0"_config.yml
+server:
+ pre_compressed: true$ rm -r node_modules/
$ npm i
$ hexo sCheck response header. |
275b510 to
bf427b2
Compare
|
Added test. |
| extensions: | ||
| - html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as they are not the default. User can always refer to https://github.com/expressjs/serve-static#options.
00dedba to
713ce74
Compare
8f75394 to
eb1c4f0
Compare
- fix compatibility with trailing .html
|
I would say that hexo-server is a debug server only, not a prod server. Should absolutely not be used to serve a site except for testing! So in that context, really no need to have compression, pre compression, .... |
Serve pre-compressed assets when found, else fallback to dynamic compression (when both
compressandpre_compressedare enabled).compressis independent frompre_compressed, so either one can be enabled.Adapted from pre-compressed-assets middleware plus this fix, with es6 syntax and utilize hexo router (instead of node-glob).