Search code examples
gulp

create file at a restricted directory using gulp-dest


I have written an gulp script as :

    gulp.task('scss', function(done) {
  gulp.src('home/a.scss')
    .pipe(sass({
      errLogToConsole: true
    }))
    .pipe(rename('chatbot.css'))
    .pipe(gulp.dest('/var/www/html/css'))  // restrcited path
    .pipe(minifyCss({
      keepSpecialComments: 0
    }))
    .on('end', done);
});

here /var/www/html/css is a directory created via sudo hence no files can be created inside it normally.

so how can i create this file using gulp.


Solution

  • You could use chown to change the ownership of the folder, so that it belongs to your user account again: https://askubuntu.com/questions/6723/change-folder-permissions-and-ownership

    Or you could try sudo gulp scss, I guess.