eneko89 / cachekill Goto Github PK
View Code? Open in Web Editor NEWSimple command line cache busting tool which fingerprints files with a content hash.
License: MIT License
Simple command line cache busting tool which fingerprints files with a content hash.
License: MIT License
after usage, one image got a wrong replacing.
in the folder the image ist called:
placeholder-valentin-f956d81ec00f7b2e5592ade6fe9f2983.webp
in the html file it was replaced with:
placeholder-valentin-f956d81ec00f7b2e5592ade6fe9f2983-ef63272fee16e03b4c225a575f56864d.webp
Steps to reproduce the bug
Download one page of my website and all its assets with the command
wget -E -k -K -p https://www.mathebibel.de
Open the folder áēww.mathebibel.de
and run the command
cachekill -l 16 -r -p '{name}.{hash}{ext}' -s '**/*.{svg,jpg,jpeg,png,ico,ttf,woff,woff2}' -t '**/*.{html,css,js,webmanifest}'
Open the file index.html
and search for da5a9c97d2054b2a
.
You will get the following 6 hits:
bilder/logo.da5a9c97d2054b2a.png
awards/gpi-logo.da5a9c97d2054b2a.png
awards/stern-logo.da5a9c97d2054b2a.png
awards/ntv-logo.da5a9c97d2054b2a.png
bilder/logo.da5a9c97d2054b2a.png
bilder/easy-tutor-logo.da5a9c97d2054b2a.png
Number 1 and 5 are correct replacements. Number 2, 3, 4 and 6 are wrong replacements.
This was just an example. You can find even more wrong replacements in the index.html
.
First of all thanks for the time you spent in this project. It really fits my needs at the moment:)
When i use the tool and use one reference on two points, it always changes only the first one.
(So when i have 1 picture that i call on two places of the page, the link in the is css only search and replaced by one of them.
So 1 picture still links to the old name)
In the documentation of "replace-in-file" they talk about a regex which is need: https://www.npmjs.com/package/replace-in-file#replace-all-occurrences
Would be in line 129 of your code if i am correct.
Issue
If the pattern is {name}{ext}?{hash}
the source files shouldn't be fingerprinted.
Background information
Appending a query string without changing the file names is a popular cache busting technique.
Implementation
There are several ways to implement this:
{name}{ext}?{hash}
then don't fingerprint source files (don't generate copy/don't allow replacement).-S, --Source
-> Source file(s) without fingerprinting.-Q, --Query
which sets the pattern to {name}{ext}?{hash}
and doesn't fingerprint source files.A declarative, efficient, and flexible JavaScript library for building user interfaces.
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. đđđ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google â¤ī¸ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.