How can I use Gulp to add a line of text to a file
问题 I've been trying to figure out how to add a line of text to any type of file using Gulp. For instance add: @import 'plugins' to my main.sass file. Or add a CDN to an index.html file. I did try: gulp.task('inject-plugins', function(){ gulp.src('src/css/main.sass') .pipe(inject.after('// Add Imports', '\n@import \'plugins\'\n')); }); with no joy. Any idea how I could achieve this please? 回答1: Depends on what you want to do. If you just want to add text to the beginning or end of a file gulp