Skip to content

Commit a7a5043

Browse files
committed
feat: use lodash merge for deep merging
1 parent bf1b882 commit a7a5043

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.eleventy.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const SVGSprite = require("./src/SVGSprite");
2+
const lodash = require('lodash');
23

34
let idCounter = 0;
45

@@ -15,7 +16,11 @@ module.exports = (eleventyConfig, pluginConfig = [{}]) => {
1516
}
1617

1718
let defaultOptions = require("./src/options");
18-
let config = Object.assign(defaultOptions, options);
19+
let config = lodash.merge(defaultOptions, options);
20+
21+
// Debug statement to log config after merge
22+
// const util = require('util')
23+
// console.log(util.inspect(config, {showHidden: false, depth: null, colors: true}))
1924

2025
if (svgSpriteShortcodeList.includes(config.svgSpriteShortcode)) {
2126
throw new Error("[eleventy-plugin-svg-sprite] illegal to have duplicate svgSpriteShortcode in config list");

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@11ty/eleventy": ">=0.5.4"
3030
},
3131
"dependencies": {
32+
"lodash": "^4.17.21",
3233
"svg-sprite": "2.0.0"
3334
}
3435
}

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ lodash.trimstart@^4.5.1:
428428
resolved "https://registry.yarnpkg.com/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz#8ff4dec532d82486af59573c39445914e944a7f1"
429429
integrity sha512-b/+D6La8tU76L/61/aN0jULWHkT0EeJCmVstPBn/K9MtD2qBW83AsBNrr63dKuWYwVMO7ucv13QNO/Ek/2RKaQ==
430430

431+
lodash@^4.17.21:
432+
version "4.17.21"
433+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
434+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
435+
431436
logform@^2.3.2, logform@^2.4.0:
432437
version "2.4.2"
433438
resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.2.tgz#a617983ac0334d0c3b942c34945380062795b47c"

0 commit comments

Comments
 (0)