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

use path.join for relativeFilePath #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dawaltconley
Copy link

The current method of getting a relative file path results in some wacky behavior. Taking an example from the docs...

{{ 'path/to/file.svg' | svgContents }} <!-- looks in ./.path/to/file.svg -->
{{ '/path/to/file.svg' | svgContents }} <!-- looks in ./path/to/file.svg -->
{{ './path/to/file.svg' | svgContents }} <!-- looks in ../path/to/file.svg -->

That means that the user actually needs to write an absolute file path in order to get a relative file path. Using path.join solves this:

{{ 'path/to/file.svg' | svgContents }} <!-- looks in ./path/to/file.svg -->
{{ '/path/to/file.svg' | svgContents }} <!-- looks in ./path/to/file.svg -->
{{ './path/to/file.svg' | svgContents }} <!-- looks in ./path/to/file.svg -->

@gilesbowkett
Copy link

hi @dawaltconley, just fyi, I've cherry-picked this commit onto my fork because I'm not sure if this repo's still active.

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