Closed oupala closed 7 years ago
My pull request is just a try but at least it works on my windows system. It might be quick and dirty, but feel free to improve it.
And I have absolutely no idea how to test this, unfortunately I won't be able to add tests to this pull request. I'm sorry for this but I've done my best.
I would very much love to see this PR merged and a new version pushed, I am developing on both Windows and Linux and that's giving a lot of problems.
In the mean time, you can always do this:
var fixFingerprint = function () {
'use strict';
return function (files, metalsmith, done) {
var metadata = metalsmith.metadata(),
fingerprint = metadata.fingerprint,
newFingerprint = {};
for (var key in fingerprint) {
var newKey = key.replace(/\\/g, '/');
var newValue = fingerprint[key].replace(/\\/g, '/');
newFingerprint[newKey] = newValue;
}
metadata.fingerprint = newFingerprint;
done();
};
};
And use it:
.use(fingerprint({ pattern: '{styles,scripts}/**/*.{css,js}' }))
.use(fixFingerprint())
That will also give a cross platform working solution while waiting for a PR.
@christophercliff I'd be glad if you can merge my pull request.
Fixed in #8
It appears that the issue is not fixed yet as it does not work on my windows machine, please reopen this issue.
I'm willing to test any potential solution on my env.
Tested and validated on Windows.
Ok, let's recap the commits and the pull requests trying to fix this issue.
There has been 4 commits and 2 pull requests.
As you can see the only merged pull request was merged at a state were it was not working.
There is still two commits that work and could be merged. The first one is the most elegant while the second one seems more simpler.
Hey @christophercliff, you added the pull request appreciated label.
There is a pull request.
If I could I would add the merge appreciated label!
I would greatly appreciate to see any pull request merged. Any news about that?
I created a new pull request #13 so that you can merge it easily.
I'm trying to use this plugin and I'm close to succeed.
This works well.
This works almost well. But it seems that the created object in metalsmith has no normalized path. As a consequence, the way of accessing the object is different depending of if I'm on linux or on windows :
<link href="/{{fingerprint.[css/app.css]}}" rel="stylesheet" type="text/css" />
<link href="/{{fingerprint.[css\\app.css]}}" rel="stylesheet" type="text/css" />
This makes impossible to use this plugin when developing on windows and integrating on linux.
Normalizing the path should make the plugin OS agnostic.