Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt - create empty file

Tags:

file

gruntjs

How to create a new empty file in a Grunt task?

I want to set up a project and create a new file in the process. The file will be empty. I don't want to use unnecessary plugins that are not intended for this purpose.

Is there a simple way to do such thing?

like image 249
Elwhis Avatar asked Dec 01 '22 16:12

Elwhis


1 Answers

You could use grunt.file.write:

grunt.registerTask('emptyFile', 'Creates an empty file', function() {
   grunt.file.write('path/to/file', '');
});
like image 134
asgoth Avatar answered Dec 09 '22 11:12

asgoth