Closed callum closed 9 years ago
:+1:
I would also like to discard the original file, having unnecessary duplicates in my build directory and production feels wrong!
@BlueHayes made a PR here https://github.com/christophercliff/metalsmith-fingerprint/pull/6
I'll leave this open for now, but recommend you make use of https://github.com/segmentio/metalsmith-ignore to clean up your build directory.
Thanks for the recommendation, do you have any suggested ways to use metalsmith-ignore to pick up on non-fingerprinted files? It seems like it may be difficult (and not very reliable) unless I'm missing a trick.
Ah I see. I'm doing the same for my less directory now (thanks for the plugin tip). However I'm applying the fingerprint plugin against "images/*/", so in the build directory we end up with e.g. "images/logo.jpg" and "images/logo-[hash].jpg" for a whole bunch of images. So in this kind of setup it could make sense for the fingerprint plugin to dispose of duplicated images itself.
Try the https://github.com/isaacs/minimatch docs.
I'm already using metalsmith-ignore in my project @christophercliff, but I'm still interested in the rationale behind keeping files. I don't see it as desired behaviour.
I'm matching on all images with this https://github.com/callum/sparks-inc.org/blob/master/build.js#L32. The reason the ignore plugin doesn't work is because it doesn't have knowledge of the files that have been fingerprinted. There's no reliable way to match against the files that have been passed through, unless you recalculated the md5 hash and used that. This is the same issue @BlueHayes is describing.
Would something like this solve your problem? http://www.globtester.com/#p=eJxLLi7WV9TQ0tXS1EsuLgYAHPgD4w%3D%3D&r=eJyzScksU0jOSSwutlXKTSxJzlCySy4u1s%2FMS0mt0AOybPSBCuxskFQhKdBNM0oytLBIMzNLSzY3STROSzI2MTO3TLMwNDc0NTVNMkSYAAA0hyF8&
This would still leave any images in the build dir which have a hyphen in the filename. It's helpful but doesn't cover all cases.
Example:
Yeah maybe but that's what I mean by reliably. What if a file is named 'something-somethingelse.css'
^^ @BlueHayes that
Why is this issue closed?
I might be overlooking the obvious, but why is the original file kept in the pipeline? Both files are written to the build directory.