如果没有匹配的文件,汇编目标可以被抑制吗? (不使用--force) [英] Can an assemble target be silenced if there are no matching files? (Without using --force)

查看:130
本文介绍了如果没有匹配的文件,汇编目标可以被抑制吗? (不使用--force)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有汇编咕噜目标:

  docs:{
files:{'<%= site.tmp%> /':['<%= site.pages%> / ** /*.html']}
},

如果没有匹配的内容,抱怨说:警告:找不到源文件,使用 - 强制继续。任务然后中止。我不介意警告,但我希望可以选择将任务配置为继续,而不必在命令行上使用--force。这可能吗?



ps。此任务现在失败的原因是我已将内容转换为降价。我试图建立一个脚手架,允许用户以任何组合使用markdown,hbs或html。



 文档:{
files:{'<% = site.tmp%> /':['<%= site.pages%> / ** / *。{html,hbs,md}']}
},

该代码基本上查找以 .html .hbs .md



由于这真的是Grunt错误,您只需编写文件对象以允许更多的可能性。

例如,上述内容只适用于该位置实际上有文件的情况。如果Grunt在该位置查找并且没有看到任何可接受的文件,它将显示您现在正在获取的错误。

I have this assemble grunt target:

docs: {
  files: {'<%= site.tmp %>/': ['<%= site.pages %>/**/*.html'] }
},

If there is no matching content, it complains, saying "Warning: Source files not found. Use --force to continue". The task then aborts. I don't mind the warning but I would like the option to configure the task to continue rather than having to use "--force" on the command line. Is this possible?

ps. The reason why this task is now failing is that I have converted the content to markdown. I am trying to build a scaffold that allows users to use markdown, hbs or html in any combination.

解决方案

Based on what you are saying, you can use a little unix trick here.

docs: {
  files: {'<%= site.tmp %>/': ['<%= site.pages %>/**/*.{html,hbs,md}'] }
},

That code basically looks for anything ending in .html, .hbs, or .md.

Since this is really a Grunt error, you would need to simply write your file object to allow for more possibilities.

For example, the above would only work if the location actually has files. If Grunt looks in that location and doesn't see any of the acceptable files, it will display the error you are getting now.

这篇关于如果没有匹配的文件,汇编目标可以被抑制吗? (不使用--force)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆