So just to give you some context, I\'m trying to create a generator that will create some files (based on user input of course) as well as update some existing files in
Ok, so I found the answer to my question.
Addy Osmani showed me where to look in this thread on twitter, and then I later found this link which shows exactly what I need.
The gist of it boils down to two functions : readFileAsString
and write
. Usage is as follows:
var path = "/path/to/file.html",
file = this.readFileAsString(path);
/* make modifications to the file string here */
this.write(path, file);
Edit: I've also blogged about this on my blog.
As mentionned in comments by Toilal :
The
write
method doesn't exists anymore, and must be replaced bywriteFileFromString
(arguments are also reversed) – Toilal
And then, as mentionned in comments by ivoba:
this.writeFileFromString
&this.readFileAsString
are deprecated, github.com/yeoman/html-wiring should be used by now, things change :) – ivoba