javascript - gulp遍历文件夹压缩css,无效
问题描述

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));}) })});
这样无效,不知道是不是gulp哪里写错了,地址destUrl两个都可以获取到
问题解答
回答1: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));}) })});回答2:
还是自己动手丰衣足食 http://www.gulpjs.com.cn/docs...
回答3:目录里不要出现中文
相关文章:
1. angular.js - 在ng-option 里使用过滤器无效2. javascript - webpack --hot 热重载无效的问题3. html5 - z-index在浏览器调试有效 手机测试无效4. javascript - window.opener.close()无效5. css - 在body里使用 -webkit-overflow-scrolling: touch;无效6. javascript - 微信小程序在wx:for循环里判断数据再给类名,条件为动态时无效7. angular.js - angularjs 中 input 绑定ng-model 无效8. Java:密码包(加密和解密)。无效的密钥错误9. javascript - jquery hide()方法无效10. css - linear-gradient无效是怎么回事?

网公网安备