Using path module to rebase remote resources causes URLs to be messed up and fail.
Example:
My HTML has Bootstrap css file referenced like this:
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Bootstrap references font files like this:
src:url(../fonts/glyphicons-halflings-regular.eot);
html.js is invoking css.js passing rebaseRelativeTo option calculated as path.join( settings.relativeTo, args.src, ".." + path.sep ). This produces https:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css/ (double slash was lost as a result).
In the end https:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css/ is not treated as a remote (RegExp test fails) and font is attempted to be retrieved from /local/directory/path/https:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css\fonts/glyphicons-halflings-regular.eot
path.join() and path.relative() should not be used while dealing with remotes.
Using path module to rebase remote resources causes URLs to be messed up and fail.
Example:
My HTML has Bootstrap css file referenced like this:
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Bootstrap references font files like this:
src:url(../fonts/glyphicons-halflings-regular.eot);
html.js is invoking css.js passing
rebaseRelativeTo
option calculated aspath.join( settings.relativeTo, args.src, ".." + path.sep )
. This produceshttps:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css/
(double slash was lost as a result).In the end
https:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css/
is not treated as a remote (RegExp test fails) and font is attempted to be retrieved from/local/directory/path/https:/netdna.bootstrapcdn.com/bootstrap/3.3.7/css\fonts/glyphicons-halflings-regular.eot
path.join() and path.relative() should not be used while dealing with remotes.