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

automatically convert local file paths to file url #68

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

Conversation

klieber
Copy link
Contributor

@klieber klieber commented Nov 4, 2020

In the current version of the script you must use the syntax file:///path/to/file when referencing a local file. This works but can be difficult to work with when you simply want to build a pdf for a file in the current directory. You can do something like file://$(realpath index.html) but that is not cross platform and doesn't work in environments like Git Bash for Windows.

This change utilizes the file-url package to automatically convert local file paths to a file url. It will only do so when the provided url does not start with http, https, or file.

@klieber klieber force-pushed the feature/generate-local-file-urls branch from e569644 to 818198a Compare November 4, 2020 17:57
index.js Outdated Show resolved Hide resolved
In the current version of the script you must use the syntax
`file:///path/to/file` when referencing a local file.  This works but
can be difficult to work with when you simply want to build a pdf for a
file in the current directory.  You can do something like
`file://$(realpath index.html)` but that is not cross platform and
doesn't work in environments like Git Bash for Windows.

This change utilizes the
[file-url](https://www.npmjs.com/package/file-url) package to
automatically convert local file paths to a file url.  It will only do
so when the provided url does not start with `http`, `https`, or `file`.
@klieber klieber force-pushed the feature/generate-local-file-urls branch from 818198a to 7895235 Compare November 5, 2020 02:23
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