使用 gulp-dest 在受限目录中创建文件



我写了一个 gulp 脚本为:

    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);
});

这里/var/www/html/css是通过sudo创建的目录,因此通常无法在其中创建任何文件。

那么如何使用 GULP 创建此文件。

您可以使用

chown更改文件夹的所有权,以便它再次属于您的用户帐户:https://askubuntu.com/questions/6723/change-folder-permissions-and-ownership

或者你可以试试sudo gulp scss,我猜。

最新更新