Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Invoke the generator as npm module using javascript. #34

Open
trajano opened this issue Aug 29, 2019 · 1 comment
Open

Unable to Invoke the generator as npm module using javascript. #34

trajano opened this issue Aug 29, 2019 · 1 comment
Assignees
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

Comments

@trajano
Copy link

trajano commented Aug 29, 2019

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.

@sebinbenjamin sebinbenjamin added documentation Improvements or additions to documentation in-progress Apply to PRs that are pending some work before they're ready for review. labels Aug 30, 2019
@sebinbenjamin sebinbenjamin self-assigned this Aug 30, 2019
@sebinbenjamin sebinbenjamin removed the in-progress Apply to PRs that are pending some work before they're ready for review. label Aug 30, 2019
@sebinbenjamin
Copy link
Owner

In the middle of major refactoring. Would appreciate putting together a PR for this.

@sebinbenjamin sebinbenjamin added the critical Added to `bug` issues if the problem described makes the code completely unusable in a common situat label Aug 30, 2019
@sebinbenjamin sebinbenjamin changed the title provide example of invoking the generator using javascript Unable to Invoke the generator as npm module using javascript. Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants