I have the following directory structure:
.
├── assets
│ └── sprite1.png
│ └── sprite2.png
│ └── sprite3.png
├── dist
│ ├── bundle.js
│ └── index.html
├── src
│ └── main.ts
├── tsconfig.json
└── webpack.config.js
I am wanting to to generate a manifest.json file in dist/ on build that will look something like this:
{
"sprite1": "../assets/sprite1.png",
"sprite2": "../assets/sprite2.png",
"sprite3": "../assets/sprite3.png"
}
I want to do this by using webpack to scan all the file paths in assets/, so that all I have to do is drag-and-drop .png files in assets/ and they will automatically be written to the manifest, which other parts of my app will use to load in assets.
Is this possible? Is there a better way to do it than using webpack?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/jCpNVUh
Comments
Post a Comment