消glob和否定

编程入门 行业动态 更新时间:2024-10-25 00:26:17
本文介绍了消glob和否定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的结构是这样的:

+ dir3 - dir3.1 - dir3.1.1 - dir3.1.2 - dir3 .2 - dir3.3 - responsive.less - fixedwidths.less

每个目录都有一组较少的文件,我想要做的是编译responsive.less和fixedwidths.less,但我想忽略 dir3中的所有其余文件夹 code>。

用于编译少量文件的Gulp Glob是:

var paths = { root:'Publication /', source:'Publication / LESS /', styles:'Publication / ** / *。less' $ b编译更少的文件 gulp.task('styles',function(){ gulp.src([ paths.source +'* * / *。less',//编译全部'!'+ paths.source +'** / variables.less',//忽略所有变量。 paths.source +'responsive / *。less',//编译响应&固定宽度'!'+ paths.source +'responsive / ** / *。less'//忽略dir3的子目录中的所有较少文件]) .pipe(less()) .pipe(gulp.dest(paths.root +'build'))});

我在期待 paths.source +'responsive / *。less'会匹配responsive.less和fixedwidths.less和'!'+ paths.source +'responsive / ** / *。less'会忽略其他所有内容但那不是似乎正在发生的事情。后一位代码似乎阻止了dir3的所有处理。

什么可以帮助?

解决方案

节点glob中存在与否定glob模式相关的错误。请参阅凉亭问题和 node-glob问题。也许你的问题与此有关?

如果是这样,这个解决方法应该工作'./!('+ paths.source +'responsive / * * / *。less)'。

I'm having an issue where I'm unable to compile a set of LESS file using Globbing.

My structure is this:

+ dir3 - dir3.1 - dir3.1.1 - dir3.1.2 - dir3.2 - dir3.3 - responsive.less - fixedwidths.less

Each dir has a set of less files and what I'm trying to do is to compile responsive.less and fixedwidths.less but i want to ignore all the remaining folders in dir3.

My Gulp Glob for compiling less files is:

var paths = { root: 'Publication/', source: 'Publication/LESS/', styles: 'Publication/**/*.less' } // Compile less files gulp.task('styles', function() { gulp.src([ paths.source+'**/*.less', // compile it all '!'+paths.source+'**/variables.less', // ignore all variables.less paths.source+'responsive/*.less', // compile responsive & fixedwidths '!'+paths.source+'responsive/**/*.less' // ignore all less files in subdir of dir3 ]) .pipe(less()) .pipe(gulp.dest(paths.root+'build')) });

I was expecting that paths.source+'responsive/*.less' would match responsive.less and fixedwidths.less and '!'+paths.source+'responsive/**/*.less' would ignore everything else but that's not what seems to be happening. The latter bit code seems to halt all processing of dir3.

Can anything help?

解决方案

There is a bug in node-glob related to negated glob patterns. See this bower issue and this node-glob issue. Maybe your problem is related to this?

If so, this workaround should work './!('+paths.source+'responsive/**/*.less)'.

更多推荐

消glob和否定

本文发布于:2023-10-07 14:37:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469653.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:glob

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!