当我运行gulp命令时,我的文件失去了许可权

时间:2021-10-21 23:02:15

I'm using Ubuntu and it's work fine but when I run the gulp command I got a problem. The file was created but Gulp changes the file permissions and the browser can't read the file. So I can't navigate in my project website. =/

我正在使用Ubuntu并且它工作正常但是当我运行gulp命令时我遇到了问题。该文件已创建,但Gulp更改了文件权限,浏览器无法读取该文件。所以我无法在我的项目网站中导航。 = /

当我运行gulp命令时,我的文件失去了许可权

My gulpfile.js

var gulp = require('gulp');
//~ var gulp = require('gulp-util');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');

var src='./wp-content/themes/wikitricks';
var scripts=[
            src + '/js/jquery.min.js',
            src + '/js/jquery-ui.js',
            src + '/js/jquery.tooltipster.min.js',
            src + '/js/featherlight.min.js',
            //~ src + '/js/jquery.masonry.min.js',
            src + '/js/masonry.pkgd.min.js',
        ];

gulp.task('js', function() {

    return gulp.src(scripts)
        .pipe(concat('all.js'))
        .pipe(uglify())
        .pipe(gulp.dest(src))

});

gulp.task('default', ['js'], function () {

    gulp.watch(scripts, ['js']);

});

1 个解决方案

#1


2  

I found a solution but I still don't know why it happens...

我找到了解决方案,但我仍然不知道为什么会发生...

var chmod = require('gulp-chmod');

gulp.task('copy-images', function() {
  gulp.src(path_resource_images + '**/*.jpg')
    .pipe(chmod(666))
    .pipe(gulp.dest(path_app_images));
});

From: Gulp - Handle read-only permissions for dest files?

来自:Gulp - 处理dest文件的只读权限?

#1


2  

I found a solution but I still don't know why it happens...

我找到了解决方案,但我仍然不知道为什么会发生...

var chmod = require('gulp-chmod');

gulp.task('copy-images', function() {
  gulp.src(path_resource_images + '**/*.jpg')
    .pipe(chmod(666))
    .pipe(gulp.dest(path_app_images));
});

From: Gulp - Handle read-only permissions for dest files?

来自:Gulp - 处理dest文件的只读权限?