在Gulp中使用命名约定时出错 [英] Error when using naming convention in Gulp

查看:102
本文介绍了在Gulp中使用命名约定时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Zurb Foundation框架开展这个项目,并在Gulp上运行。基本上Gulp所做的就是将sass转换为css,compress,concatenate等等。它运行完美,它做它应该做的事情,直到我尝试更改 dist 文件夹,其中一切都是为生产而构建的。我想要使​​用的名称是 name-html5 -html5 3dCart 的命名约定,因此它需要 -html5 中的文件夹的名称。在 gulpfile.babel.js 我有:

I am working on this project using Zurb Foundation framework and it runs on Gulp. Basically what Gulp does is turn sass into css, compress, concatenate, etc. It runs perfect and it does what it’s suppose to do, UNTIL I try to change the name of the dist folder, where everything is built for production. The name I want to use is name-html5. The -html5 is a naming convention of 3dCart, so it needs the -html5 in the name of the folder. In gulpfile.babel.js I have:

// Delete the "dist" folder
// This happens every time a build starts
function clean(done) {
  rimraf(PATHS.dist, done);
}

如果我将 dist ReferenceError:html5没有被定义,因为<$ c name-html5 $ c> - 在它前面。它不需要(PATHS.name-html5,done)

If I substitute the dist for name-html5 I get a build error: ReferenceError: html5 is not defined because of the - in front of it. It just won’t take (PATHS.name-html5, done).

另外,我更改了名称在 config.yml 文件中:

Also, I changed the name in config.yml file:

# Gulp will reference these paths when it copies files
PATHS:
  # Path to dist folder
  dist: "dist"  

但它没有解决问题。任何帮助?

but it didn't fix the issue. Any help?

推荐答案

不是有一个 name-html5 属性名称,试着拿出连字符。它可以保留在值中。

Instead of having a name-html5 property name, try taking out the hyphen. It can stay in the value.

# Gulp will reference these paths when it copies files
PATHS:
  # Path to dist folder
  dist: "dist"
  nameHtml5: "name-html5"

然后引用它作为 PATHS.nameHtml5

这篇关于在Gulp中使用命名约定时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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