eleventy-auto-cache-buster 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/11tyAutoCacheBuster.js +5 -5
- package/package.json +1 -1
package/11tyAutoCacheBuster.js
CHANGED
|
@@ -73,7 +73,7 @@ module.exports = function(eleventyConfig, options=defaultOptions) {
|
|
|
73
73
|
logGreen(`[ACB] ${assetPath} hash = ${assetHash}`);
|
|
74
74
|
|
|
75
75
|
assetPaths.push({
|
|
76
|
-
assetPath: assetPath.replace(dir.output, ""),
|
|
76
|
+
assetPath: assetPath.replace(dir.output + "/", ""),
|
|
77
77
|
assetHash: assetHash
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -81,22 +81,22 @@ module.exports = function(eleventyConfig, options=defaultOptions) {
|
|
|
81
81
|
logYellow(`[ACB] Collected all asset hashes!`);
|
|
82
82
|
logRegular(`[ACB] Replacing in output...`);
|
|
83
83
|
|
|
84
|
-
// For every
|
|
84
|
+
// For every page Eleventy outputs
|
|
85
85
|
results.forEach(({inputPath, outputPath, url, content}) => {
|
|
86
86
|
let outputData = ""; // Assigned later
|
|
87
87
|
let outputChanged = false; // Check if any hashes have been added
|
|
88
88
|
|
|
89
89
|
// Read the output content
|
|
90
|
-
fs.readFile(outputPath, encoding="UTF-8", (err,
|
|
90
|
+
fs.readFile(outputPath, encoding="UTF-8", (err, pageData) => {
|
|
91
91
|
if (err) {
|
|
92
92
|
logRed(err);
|
|
93
93
|
throw err;
|
|
94
94
|
}
|
|
95
95
|
// Save the output data
|
|
96
|
-
outputData =
|
|
96
|
+
outputData = pageData;
|
|
97
97
|
|
|
98
98
|
assetPaths.forEach(({assetPath, assetHash}) => {
|
|
99
|
-
if (
|
|
99
|
+
if (pageData.includes(assetPath)) {
|
|
100
100
|
logGreen(`[ACB] ${outputPath} contains asset ${assetPath}`)
|
|
101
101
|
|
|
102
102
|
if (hashTruncate > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-auto-cache-buster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Busts cache using ?v= with minimal configuration!",
|
|
5
5
|
"main": "11tyAutoCacheBuster.js",
|
|
6
6
|
"repository": "https://github.com/Denperidge/eleventy-auto-cache-buster.git",
|