我已经根据烬-cli的文档创建了一个定制的蓝图,我希望在第一个蓝图中运行一个不同的蓝图(本质上是ember g something-else ...)。我该怎么做?
具体用例:我已经覆盖了Ember的默认组件蓝图,并且我希望在我的新组件蓝图中为每个生成的组件生成一个匹配的CSS部分(在app/styles/components/中)。
发布于 2016-07-19 17:08:21
在生成器内部(可能是app/blueprints/blueprint-name/index.js):
var Blueprint = require('ember-cli/lib/models/blueprint');
module.exports = {
...
afterInstall: function(options) {
var otherBlueprint = Blueprint.lookup('other-blueprint-name', {
paths: [path.resolve(__dirname, '..')]
});
return otherBlueprint.install(options);
},
};感谢无空空在calling-ember-g-component-within-a-blueprints-index-js上指出了这种方法。
https://stackoverflow.com/questions/38464568
复制相似问题