Unable to Invoke the generator as npm module using javascript. #34
Labels
critical
Added to `bug` issues if the problem described makes the code completely unusable in a common situat
documentation
Improvements or additions to documentation
Is your feature request related to a problem? Please describe.
I want to be able to run this as part of a cordova before_compile hook
Add labels
Add all relevant labels as discussed in https://github.com/sebinbenjamin/image-res-generator/blob/latest/CONTRIBUTING.md#label-issues
Describe the solution you'd like
Please provide example code for using the generator from javascript instead of as a CLI.
const ImageResGenerator = require("image-res-generator")
module.exports = function(context) {
const generator = new ImageResGenerator(context.opts.projectRoot)
.withIcon("icon.svg") //optional
.withSplash("splash.svg") //optional
.withPlatforms("ios", "android") //optional
.withAllPlatforms() //reverts the withPlatforms setting
.withOutputDir("res") //ioptional
generator
.makeIcon() // invoke to make icons return self so we can chain with
.makeSplash() // invoke to make splash
}
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: