vite-plugin-svg-spritegen 2.0.0 → 2.0.2

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/dist/index.js CHANGED
@@ -172,7 +172,7 @@ var writeSprite = (spritePath, svgMap) => {
172
172
  };
173
173
  //#endregion
174
174
  //#region src/index.ts
175
- var defaultMatchPattern = /(\S*icon\S*):\s?"(?<icon>.+?)"/gi;
175
+ var defaultMatchPattern = /['"`]?icon['"`]?\s*[=:]{1}\s*['"`]{1}(?<icon>.+?)['"`]{1}/gi;
176
176
  var inputConfigDefaults = {
177
177
  pattern: "**/*.svg",
178
178
  baseDir: "./",
@@ -228,7 +228,10 @@ function svgSpritegen(config) {
228
228
  allSvgs = await buildSvgMap(inputConfigsResolved);
229
229
  await writeTypes(typesFilePath, allSvgs);
230
230
  if (config.gitignore !== false) await writeGitignore(gitignoreFilePath, "sprite.svg", "types.ts");
231
- if (isBuild) return;
231
+ if (isBuild) {
232
+ writeIfChanged(spriteFilePath);
233
+ return;
234
+ }
232
235
  writeSprite(spriteFilePath, allSvgs);
233
236
  const onWatch = (changedPath) => {
234
237
  if (changedPath === spriteFilePath) return;
package/dist/index.mjs CHANGED
@@ -144,7 +144,7 @@ var writeSprite = (spritePath, svgMap) => {
144
144
  };
145
145
  //#endregion
146
146
  //#region src/index.ts
147
- var defaultMatchPattern = /(\S*icon\S*):\s?"(?<icon>.+?)"/gi;
147
+ var defaultMatchPattern = /['"`]?icon['"`]?\s*[=:]{1}\s*['"`]{1}(?<icon>.+?)['"`]{1}/gi;
148
148
  var inputConfigDefaults = {
149
149
  pattern: "**/*.svg",
150
150
  baseDir: "./",
@@ -200,7 +200,10 @@ function svgSpritegen(config) {
200
200
  allSvgs = await buildSvgMap(inputConfigsResolved);
201
201
  await writeTypes(typesFilePath, allSvgs);
202
202
  if (config.gitignore !== false) await writeGitignore(gitignoreFilePath, "sprite.svg", "types.ts");
203
- if (isBuild) return;
203
+ if (isBuild) {
204
+ writeIfChanged(spriteFilePath);
205
+ return;
206
+ }
204
207
  writeSprite(spriteFilePath, allSvgs);
205
208
  const onWatch = (changedPath) => {
206
209
  if (changedPath === spriteFilePath) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-spritegen",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Vite plugin that generates an svg spritesheet, optionally removing unused svg files.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",