gulp traverses folders to compress css, invalid
漂亮男人
漂亮男人 2017-06-30 09:58:08
0
3
1070

gulp.task('cssoModule', ['copyModule'], function() {
    return gulp.src('./dist/module/*/*.css',function(err,files) {
        console.log("cssoModule ERROR: "+err);
        files.map(function (entry) {
            var destUrl = entry.substring(0,entry.lastIndexOf('/'));
            console.log(destUrl);
            csso()
            .pipe(gulp.dest(destUrl));
        })
    })
});

This is invalid. I don’t know if gulp has written it wrong. Both addresses destUrl can be obtained.

#
漂亮男人
漂亮男人

reply all(3)
ringa_lee
gulp.task('cssoModule', ['copyModule'], function() {
    return gulp.src('./dist/module/*/*.css',function(err,files) {
        console.log("cssoModule ERROR: "+err);
        files.map(function (entry) {
            var destUrl = entry.substring(0,entry.lastIndexOf('/'));
            console.log(destUrl);
            
            // 改成这样试试
            return gulp.src(entry)
                .pipe(csso())
                .pipe(gulp.dest(destUrl));
            
            
        })
    })
});
阿神

It’s better to have enough food and clothing by yourself
http://www.gulpjs.com.cn/docs...

仅有的幸福

No Chinese characters appear in the directory

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template