Skip to content

Commit d23445e

Browse files
committed
fix: update glob usage based on updated promise feature
1 parent a7cdf7c commit d23445e

File tree

3 files changed

+222
-11
lines changed

3 files changed

+222
-11
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"@11ty/eleventy": ">=0.5.4"
3030
},
3131
"dependencies": {
32+
"glob": "^10.3.3",
3233
"lodash": "^4.17.21",
33-
"svg-sprite": "2.0.0"
34+
"svg-sprite": "2.0.0",
35+
"vinyl": "^3.0.0"
3436
}
3537
}

src/SVGSprite.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
const { glob } = require('glob');
12
const fs = require('fs');
2-
const libUtils = require('./lib-utils');
33
const path = require('path');
4+
const SVGSpriter = require('svg-sprite');
45
const util = require('util');
5-
const glob = require('glob');
66
const Vinyl = require('vinyl');
7-
const SVGSpriter = require('svg-sprite');
7+
8+
const libUtils = require('./lib-utils');
89

910
let spriteCache = {};
1011

@@ -21,8 +22,7 @@ class SVGSprite {
2122

2223
async compile() {
2324
// Get all SVG files in working directory
24-
const getFiles = util.promisify(glob);
25-
const files = await getFiles('**/*.svg', { cwd: this.cwd });
25+
const files = await glob(`**/*.svg`, { cwd: this.cwd });
2626
const newCacheKey = files.map(file => `${file}:${fs.statSync(path.join(this.cwd, file)).mtimeMs}`).join("|");
2727
// Note: Replace custom file watching with chokidar if there are bugs/limitations.
2828
// https://github.com/paulmillr/chokidar

0 commit comments

Comments
 (0)