diff options
| author | Tim Keller <tjkeller.xyz> | 2025-05-23 14:30:44 -0500 |
|---|---|---|
| committer | Tim Keller <tjkeller.xyz> | 2025-05-23 14:30:44 -0500 |
| commit | 470883b4b836447692ac3ea5d2b4fc50cbdfecba (patch) | |
| tree | b9548fb32225b5733a7becbcc0eaa42b2770b88d | |
| parent | e01a5e79337f31e656ed6d87c3cc168a06f0f27a (diff) | |
| download | material-svg-atlas-plugin-webpack-470883b4b836447692ac3ea5d2b4fc50cbdfecba.tar.xz material-svg-atlas-plugin-webpack-470883b4b836447692ac3ea5d2b4fc50cbdfecba.zip | |
create directories for file
| -rw-r--r-- | material-symbols-plugin.js | 4 | ||||
| -rw-r--r-- | utils.js | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/material-symbols-plugin.js b/material-symbols-plugin.js index b161883..48b1123 100644 --- a/material-symbols-plugin.js +++ b/material-symbols-plugin.js @@ -3,7 +3,7 @@ const path = require("path") const crypto = require("crypto") const axios = require("axios") const { Compilation } = require("webpack") -const { generateAtlasViewsFromReferences } = require("./utils.js") +const { generateAtlasViewsFromReferences, createDirectoriesForFile } = require("./utils.js") class MaterialSymbolsDownloader { @@ -126,6 +126,8 @@ class MaterialSymbolsAtlasPlugin { await cache.storePromise(cacheKey, null, atlas) } + createDirectoriesForFile(this.filename) + compilation.emitAsset( this.filename, new compiler.webpack.sources.RawSource(atlas) @@ -74,5 +74,8 @@ async function generateAtlasViewsFromReferences(refs, symbolId) { return generateAtlasViews(result.symbol.sprite.contents.toString(), symbolId) } +function createDirectoriesForFile(filePath) { + fs.mkdirSync(path.dirname(filePath), { recursive: true }) +} -module.exports = { generateAtlasViews, generateAtlasViewsFromReferences } +module.exports = { generateAtlasViews, generateAtlasViewsFromReferences, createDirectoriesForFile } |
