Open bhamon opened 9 years ago
this seemed to work for me in windows with the existing juice library in windows:
var path = require('path');
juice.juiceContent(html, {
url: 'file:' + path.sep + path.sep + 'styles' + path.sep
}, function renderTemplate(err, html) {
// do something
});
Your example would mean that the final URI is file:\\styles\
on Windows (as the path.sep var equals to \
on Windows platforms) which is incorrect (see http://en.wikipedia.org/wiki/File_URI_scheme or http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx).
In my particular case, I use the swig-email-templates node module which gives juice a path that looks like file://c:\path\to\style.css
when I specify a <link rel="stylesheet" href="style.css">
tag in my template. The file://
part is more correct on this example, even if it's still incorrect regarding to the URI RFCs.
I totally agree the example I give will format as you've shown, and it's not to the URI schema spec... But I know that it works with the current implementation of how juice parses a link href
I'm having the same problem. @bhamon soultion worked for me. can It be merged to juice ?
On Windows, parsing fails to retrieve the href'd file.
Full stack trace of the exception :
Correction :
Replace
With