grunt-sed icon indicating copy to clipboard operation
grunt-sed copied to clipboard

Output File

Open kyleknighted opened this issue 12 years ago • 5 comments

So, I dug in a bit. It appears to be basically running a sed -i command, replacing the current file with the updates.

Is it possible have an output file so that I can write the file to a different place?

kyleknighted avatar Feb 14 '13 21:02 kyleknighted

Well right now grunt-sed is basically just a wrapper around replace and that only supports in-place edits. What you're asking for is pretty reasonable – I could either swap out the usage of replace with my own custom implementation or I can fork replace and add the functionality there. I'm more inclined to do the latter, assuming this is something @harthur would be ok with.

If you want to take a stab at this go for it, otherwise I don't think I'll have time to work on this until later next week.

jharding avatar Feb 14 '13 21:02 jharding

Looks like I could do a grunt.file.copy in the interim. And then run sed on the copied version of the file.

kyleknighted avatar Feb 14 '13 22:02 kyleknighted

Yeah that's not ideal, but it should work. I'll be sure to update this issue when I end up implementing this.

jharding avatar Feb 14 '13 22:02 jharding

Seemed to work for the time being. If I end up with spare time I will see if I can do anything, but I'm in the same boat and probably won't be able to get to it for a week.

kyleknighted avatar Feb 14 '13 23:02 kyleknighted

Only had a few minutes to spare, but I spent 15 minutes or so getting an output concept started.
https://github.com/idpro/replace/tree/feature/output-file

I'll try and get it integrated a bit better and tests made, but with recent news I won't have much time to deal with it for the next couple weeks. Feel free to tinker or hit me up with some ideas for better implementation (or write it better, yourself) whatever works :)

kyleknighted avatar Feb 16 '13 23:02 kyleknighted