Grunt - create an empty file

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

I want to create a project and create a new file in this process. The file will be empty. I do not want to use unnecessary plugins that are not intended for this purpose.

Is there an easy way to do such a thing?

+4
source share
1 answer

You can use grunt.file.write :

grunt.registerTask('emptyFile', 'Creates an empty file', function() {
   grunt.file.write('path/to/file', '');
});
+16
source

Source: https://habr.com/ru/post/1529184/


All Articles