nuxt-apis-to-file
nuxt-apis-to-file copied to clipboard
File Output and Mapper Function
Describe the solution you'd like It would be cool if you could include a mapping function as a part of the config file. So that, when the request is completed, the data is passed through the function before being output to the file.
I would also like to be able to utilise fs-extra's outputFile function, as I am outputting to a .scss file.
Describe alternatives you've considered I have modified the module.js in my local install with a hard-coded mapper function to do what I need to. I may look at implementation also and submit a PR depending on where you are at with the project.
Additional context I am using the module to pull some data from a CMS API (sanity) and pass some colors and other variables as Global SCSS variables that in then injected throughout the Nuxt app. I haven't considered performance of these changes, as I am generating for static.
Just thinking about this workflow a bit further and how it would integrate with the app. I have it working in my environment to be able to pass a 'type' to the file for json or static output, and also to pass a mapper function.
Just thinking that there could be a use case to output data to more than one file? So perhaps allowing the file property to be an array could be also be beneficial.
Hi @bevanjkay 😄
Thank You for your advices!
I was already thinking about something similar due to the fact that i need it in one of my project XD
I think I'll try to add these enhancements as soon as I'm free! In this moment I'm a little bit busy!
If You want you can try to help my with a PR with these new features!
Have a nice day! 😸