From b4d0b0293812afba9637c7e636bfa51366a030f7 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Fri, 13 Jun 2025 13:42:21 -0500 Subject: cleanup package and fix bug from not importing fs/path in utils --- atlas-plugin.js | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 atlas-plugin.js (limited to 'atlas-plugin.js') diff --git a/atlas-plugin.js b/atlas-plugin.js deleted file mode 100644 index 69f1174..0000000 --- a/atlas-plugin.js +++ /dev/null @@ -1,36 +0,0 @@ -const fs = require("fs") -const path = require("path") -const { RawSource } = require("webpack-sources") -const { generateAtlasViews } = require("./utils.js") - - -class SVGSymbolAtlasViewPlugin { - constructor(options = {}) { - this.suffix = options.suffix || ".svg" - this.symbolId = options.symbolId || null - } - - apply(compiler) { - compiler.hooks.thisCompilation.tap("SVGSymbolAtlasViewPlugin", (compilation) => { - compilation.hooks.processAssets.tap( - { - name: "SVGSymbolAtlasViewPlugin", - stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, - }, - (assets) => { - for (const assetName in assets) { - if (assetName.endsWith(this.suffix)) { - const originalSVG = assets[assetName].source().toString() - const atlasSVG = generateAtlasViews(originalSVG, this.symbolId) - - // Replace old SVG asset with new SVG - compilation.updateAsset(assetName, new RawSource(atlasSVG)) - } - } - } - ) - }) - } -} - -module.exports = SVGSymbolAtlasViewPlugin -- cgit v1.2.3