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

Resolve file paths in node fields #26

Merged
merged 7 commits into from
Nov 7, 2018
Merged

Conversation

hjvedvik
Copy link
Member

@hjvedvik hjvedvik commented Nov 3, 2018

This PR resolves all relative file paths in node fields. It also makes it possible to resolve absolute paths with a resolveAbsolutePaths option. That will make Gridsome able to process image paths from Netlify CMS etc.

When a field contains /images/image.png, Gridsome normally assumes the image is located in /static/images/* and leave the field as is, since they will be copied during deployment. But Gridsome will convert the field into an absolute file path resolved from the root folder if resolveAbsolutePaths is true. Your images should be located at {root}/images/*. The option can also take an absolute path to a folder containing the referenced files.

It also works for urls. Absolute pathnames like /image.jpg converts into absolute urls when resolveAbsolutePaths is true.

@hjvedvik hjvedvik merged commit a4baf68 into master Nov 7, 2018
@hjvedvik hjvedvik deleted the feat/resolve-field-paths branch November 7, 2018 11:50
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.

1 participant