-
Notifications
You must be signed in to change notification settings - Fork 277
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
Modify action for json files #33
Comments
I went ahead and made a custom action for this, but I definitely think this could get rolled in as a flag on Example usage from my use case is:
I also threw in an |
sorry for the late response, I agree that this would be pretty useful in some cases. I'll have to give some more thought to the best implementation for this feature. Thanks! |
hey, with plop 1.8.0 you can now create custom action types that you can share with other projects :-) |
I created a custom action type to add data to my config.json file. https://gist.github.com/mritzco/88306b56c0184e66e33374d6b6ed2751 |
nice! You could publish this out as an NPM module that others can use via plop.load(). If you want to do that and need help, let me know. |
I'll happily do! Just publish to npm or any specific requirements? |
Sorry for the delay on this response. You can look at this repo as a guide to how this is done. I'm going to try to get more instructional content together soon. |
@amwmedia Could you please take a look at this repo and let me know if that would do. Original method gets the config on the method call, while the load method passes the config on the require function. It's working with the testing file but I'm not sure it will work properly in all cases. |
My proposition is to add a modify action for JSON files, where you will provide callback instead of pattern and template. In callback you would get
JSON.parse
d object and you should also return POJsO which will beJSON.stringify
d and written to file.The text was updated successfully, but these errors were encountered: