What's the right way to add asset from a plugin
See original GitHub issueMy webpack plugin created new file e.g. ccc.svg
.
How can i add it to assets array from apply plugin section so it will appear in output path as:
MyPlugin.prototype.apply = function(compiler) {
var assetName = 'ccc.svg',
assetContent = '<svg>123</svg>';
compiler.plugin('add-asset', function(assetsArray) {
assetsArray[assetName] = assetContent;
}
}
So if I have structure like:
inputPath — assets ------- aaa.svg ------- bbb.svg
and after webpack compilation:
outputPath — assets ------- asd2131wdsf32fwer2.aaa.svg ------- gfdg8dfgdfg7dfg8dfg.bbb.svg ------- kj234hf24fwer9ger8f2.ccc.svg
It should be simple operation, but i couldn’t find a solution.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:14 (4 by maintainers)
Top Results From Across the Web
How Your Plugin Assets Work | Plugin Developer Handbook
The assets folder in your plugin is where you can store images (like plugin headers, icons, and screenshots) used on your plugin's display...
Read more >How Plugin Developers Should Manage Image Assets
Plugin developers should use assets like a banner image, screenshots and icon, to show off their plugin in search results. Here's how to...
Read more >Guide to Using the Unity Asset Store to Find Plugins and Models
Unity 2018 Video Course 25% Off ▻▻ http://bit.ly/Unity2018Course◢◤◣◥◢◤◣◥◢◤◣◥◢◤◣◥HUGE Course on Unity ...
Read more >How to add image asset when creating a plugin
Plugins can only contain these 3 files: manifest.json; code.js; ui.html. Images, fonts, scripts and other resources can only be connected by URL ...
Read more >An Introduction to Asset Handling in WordPress
WordPress has provided a few basic functions to help the developer correctly load custom assets of their theme or plugin.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@chickenwing check this out https://webpack.js.org/contribute/writing-a-plugin/#example
Did anyone manage to solve this? Having the same problem right now…