简体   繁体   English

如何设置Kraken.js生成器选项

[英]How do I set Kraken.js generator options

Im trying to find a way to generate a Kraken.js project that uses jade instead of dust templates. 我试图找到一种方法来生成使用玉而不是灰尘模板的Kraken.js项目。 According to their documentation you should be able to pass the template engine as a parameter, so yo kraken --templateModule=consolidate should generate a jade based project, however the parameter seems to have no effect on the generation of the project. 根据他们的文档,您应该能够将模板引擎作为参数传递,因此yo kraken --templateModule=consolidate应该生成一个基于玉的项目,但是该参数似乎对项目的生成没有影响。

Am I maybe setting the parameters wrong or using the wrong name for jade. 我是否可能将参数设置错误或为玉使用了错误的名称。 Unfortunately Googling the problem has not turned up anything useful. 不幸的是,谷歌搜索问题并没有发现任何有用的东西。

yo kraken --templateModule=consolidate shouldn't work and it doesn't work as it throw error: throw new Error('Unable to resolve dependency: ' + key + ':' + val yo kraken --templateModule=consolidate不起作用,因为它抛出错误,所以不起作用: throw new Error('Unable to resolve dependency: ' + key + ':' + val yo kraken --templateModule=consolidate throw new Error('Unable to resolve dependency: ' + key + ':' + val

Please take a look into dependencies.js 请看看dependencies.js

module.exports = {

    dustjs: {
        bower: [
            'dustjs-linkedin#^2.0.3',
            'dustjs-linkedin-helpers#^1.1.1'
        ],
        npm: [
            'dustjs-linkedin@^2.0.3',
            'dustjs-helpers@^1.1.1',
            'adaro@^0.1.5'
        ],
        npmDev: [
            'grunt-dustjs@^1.2.0'
        ]
    },
}

Then you must study index.js 然后,您必须学习index.js

this._addDependency('templateModule', options.templateModule);

proto._addDependency = function addDependency(key, value) {
    this[key] = value;

    if (value) {
        if (dependencies[value]) {
            this.dependencies.push(value);
        } else {
            throw new Error('Unable to resolve dependency: ' + key + ':' + value);
        }
    }
};

If you pass value that can't be find in dependencies.js if will throw an error 如果传递的值无法在dependencies.js找到,则会抛出错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM