diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2025-06-13 13:42:21 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2025-06-13 13:42:21 -0500 |
| commit | b4d0b0293812afba9637c7e636bfa51366a030f7 (patch) | |
| tree | 93b9e2d5ce841b76f5c41741a8ebca4a745571b0 /atlas-plugin.js | |
| parent | 4154e0cc1744996788b6727cd2ef4a0d3a42095e (diff) | |
| download | material-svg-atlas-plugin-webpack-b4d0b0293812afba9637c7e636bfa51366a030f7.tar.xz material-svg-atlas-plugin-webpack-b4d0b0293812afba9637c7e636bfa51366a030f7.zip | |
cleanup package and fix bug from not importing fs/path in utils
Diffstat (limited to 'atlas-plugin.js')
| -rw-r--r-- | atlas-plugin.js | 36 |
1 files changed, 0 insertions, 36 deletions
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 |
