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: add static.prefix #2755

Merged
merged 2 commits into from Feb 5, 2018
Merged

feature: add static.prefix #2755

merged 2 commits into from Feb 5, 2018

Conversation

clarkdo
Copy link
Member

@clarkdo clarkdo commented Feb 3, 2018

Resolve #2753

Add render.static.prefix to check if need to append router.base to serveStatic

@clarkdo clarkdo requested review from Atinux and pi0 February 3, 2018 16:57
@codecov-io
Copy link

codecov-io commented Feb 3, 2018

Codecov Report

Merging #2755 into dev will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #2755      +/-   ##
==========================================
+ Coverage   99.91%   99.91%   +<.01%     
==========================================
  Files          23       23              
  Lines        1211     1213       +2     
==========================================
+ Hits         1210     1212       +2     
  Misses          1        1
Impacted Files Coverage Δ
lib/common/options.js 100% <ø> (ø) ⬆️
lib/core/renderer.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2158327...e60a8e7. Read the comment docs.

@Atinux
Copy link
Member

Atinux commented Feb 4, 2018

Dont we need a default value?

@clarkdo
Copy link
Member Author

clarkdo commented Feb 4, 2018

@Atinux

useMiddleware only accepts prefix !== false https://github.com/nuxt/nuxt.js/blob/dev/lib/core/renderer.js#L193, so unless manually config static.prefix: false, it will have the prefix anyway.

)
staticMiddleware.prefix = this.options.render.static.prefix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code readability suggestion: Boolean(this.options.render.static.prefix).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may make unexpected behavior, if not config static.prefix, it will be false and ignore the prefix, but prefix should not be ignored by default.

Copy link
Member

@pi0 pi0 Feb 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what if we add a default value true in https://github.com/nuxt/nuxt.js/blob/215832769edc42e7077e8db970fbcda3276ecf0a/lib/common/options.js#L308? This prefix is little confusing now. Because it doesn't means use this prefix string but means just use prefix 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pi0 Added the default value.

@clarkdo
Copy link
Member Author

clarkdo commented Feb 4, 2018 via email

@Atinux Atinux merged commit 0a52cd2 into nuxt:dev Feb 5, 2018
@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
@clarkdo clarkdo deleted the static_prefix branch April 2, 2019 13:15
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Static image path don't need to append the base url
5 participants