eleventy-auto-cache-buster 0.9.0 → 0.9.1
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 +10 -3
- package/package.json +2 -2
package/11tyAutoCacheBuster.js
CHANGED
|
@@ -120,6 +120,11 @@ function replaceAssetsInFile(fileData, filePath, assetPathsAndHashes, writeFunc)
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// Meant to normalise eleventt.after directories.output to dir.output style
|
|
124
|
+
function stripPath(path) {
|
|
125
|
+
return path.replace(/^\.\//m, "");
|
|
126
|
+
}
|
|
127
|
+
|
|
123
128
|
module.exports = function(eleventyConfig, options=defaultOptions) {
|
|
124
129
|
// Override default options with set options
|
|
125
130
|
options = Object.assign(defaultOptions, options, {
|
|
@@ -143,8 +148,9 @@ module.exports = function(eleventyConfig, options=defaultOptions) {
|
|
|
143
148
|
|
|
144
149
|
if (runAsync) {
|
|
145
150
|
eleventyConfig.on("eleventy.after", async ({ directories, results, runMode, outputMode }) => {
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
const outputDir = stripPath(directories.output);
|
|
152
|
+
logYellow(`[ACB] Collecting assets & calculating hashes using ${globstring} in ${outputDir}...`);
|
|
153
|
+
const assetPathsAndHashes = collectLocalAssets(await glob.glob(outputDir + "/" + globstring, globOptions), outputDir, extensions);
|
|
148
154
|
|
|
149
155
|
logRegular(`[ACB] Replacing in output...`);
|
|
150
156
|
results.forEach(({inputPath, outputPath, url, content}) => {
|
|
@@ -162,8 +168,9 @@ module.exports = function(eleventyConfig, options=defaultOptions) {
|
|
|
162
168
|
});
|
|
163
169
|
} else {
|
|
164
170
|
eleventyConfig.on("eleventy.after", ({ directories, results, runMode, outputMode }) => {
|
|
171
|
+
const outputDir = stripPath(directories.output);
|
|
165
172
|
logYellow(`[ACB] Collecting assets & calculating hashes using ${globstring}...`);
|
|
166
|
-
const assetPathsAndHashes = collectLocalAssets(glob.globSync(
|
|
173
|
+
const assetPathsAndHashes = collectLocalAssets(glob.globSync(outputDir + "/" + globstring, globOptions), outputDir, extensions);
|
|
167
174
|
|
|
168
175
|
logRegular(`[ACB] Replacing in output...`);
|
|
169
176
|
results.forEach(({inputPath, outputPath, url, content}) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-auto-cache-buster",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
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",
|
|
7
7
|
"author": "Denperidge",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"start": "pushd tests &&
|
|
10
|
+
"start": "pushd tests/scenarios/8-sync@3 && eleventy && popd",
|
|
11
11
|
"test": "ava tests/test.mjs --timeout=30s"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|