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

Support embedding local paths using file:// #46

Open
offbynull opened this issue Jul 1, 2019 · 3 comments
Open

Support embedding local paths using file:// #46

offbynull opened this issue Jul 1, 2019 · 3 comments

Comments

@offbynull
Copy link

offbynull commented Jul 1, 2019

If file:// is encountered, web-resource-inliner should correctly embed the file referenced. Currently it just appends the entire link to the relativeTo path, which causes inline-ing to fail. For example, if relativeTo is set to /a/b/c, the link file:///x/y/z.js gets translated to /a/b/c/file:/x/y/z.js.

@jrit
Copy link
Owner

jrit commented Jul 9, 2019

Would accept a PR that does this

@offbynull
Copy link
Author

offbynull commented Jul 9, 2019 via email

@GaelGirodon
Copy link

GaelGirodon commented Jul 28, 2019

Hello, I have an issue related to this one working with absolute local paths.

Currently, the file URL scheme is not supported (file://) as reported by @offbynull, so, lines like this one aren't processed as they should be:

<link rel="stylesheet" href="file:///absolute/path/to/style.css">

To get rid of this issue, I pre-process the HTML file and remove file://.

It works on Windows (I get a path like C:/absolute/path/to/style.css that is processed correctly) but not on Linux because of this line of code. And that's not really a bug, because a path beginning with / normally refers to the website root (so, it is normal to prefix it with the relativeTo path value during inlining) but I don't find a way to provide a local path relative to the filesystem root (and not the website root).

I don't see how to solve this problem except by implementing the file URL scheme (to be able to provide FS absolute path) but I don't know enough about it to propose a good implementation right now.

What is your opinion on this subject?

PS : apart from this issue, @jrit, thanks for this very good tool, you really made my job easier when I built my last project!

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

No branches or pull requests

3 participants