angular-yeoman生成器的一个很酷的功能是能够通过命令行创建视图,指令和服务。 MEAN堆栈是否具有此功能,或者您是否必须将映射手动编码为任何新的依赖项?
答案 0 :(得分:0)
我认为这里的一般经验法则是,如果生成器没有用于创建控制器,视图等的子生成器,那么是的,您必须手动创建它们。另一种方法是全局安装角度生成器,然后继续在项目中运行它,然后相应地移动/映射文件。您还可以从现有的某个生成器中拉出逻辑并修改它以移动/映射适合您的项目结构的文件。
答案 1 :(得分:0)
您可以使用MEAN.IO创建自定义程序包
mean package customPackageName
create: ./packages/custom/custompackagename
create: ./packages/custom/custompackagename/app.js
create: ./packages/custom/custompackagename/package.json
create: ./packages/custom/custompackagename/bower.json
create: ./packages/custom/custompackagename/.bowerrc
create: ./packages/custom/custompackagename/README.md
create: ./packages/custom/custompackagename/server
create: ./packages/custom/custompackagename/public
create: ./packages/custom/custompackagename/public/assets
create: ./packages/custom/custompackagename/public/assets/css
create: ./packages/custom/custompackagename/public/assets/css/custompackagename.css
create: ./packages/custom/custompackagename/public/assets/img
create: ./packages/custom/custompackagename/public/controllers
create: ./packages/custom/custompackagename/public/controllers/custompackagename.js
create: ./packages/custom/custompackagename/public/directives
create: ./packages/custom/custompackagename/public/routes
create: ./packages/custom/custompackagename/public/routes/custompackagename.js
create: ./packages/custom/custompackagename/public/services
create: ./packages/custom/custompackagename/public/services/custompackagename.js
create: ./packages/custom/custompackagename/public/views
create: ./packages/custom/custompackagename/public/views/index.html
create: ./packages/custom/custompackagename/server
create: ./packages/custom/custompackagename/server/config
create: ./packages/custom/custompackagename/server/controllers
create: ./packages/custom/custompackagename/server/models
create: ./packages/custom/custompackagename/server/routes
create: ./packages/custom/custompackagename/server/routes/custompackagename.js
create: ./packages/custom/custompackagename/server/views
create: ./packages/custom/custompackagename/server/views/index.html
重新启动grunt任务后,可以在/#!/ custompackagename / example
下找到一条路线自定义程序包是一个模块。在该模块中,您可以在角度项目中加载所有已加载的资源。基本上每个模块都是一个自包含的MEAN站点。这些模块有一个特定的依赖链。您可以对仅影响此模块的指令,服务,控制器和视图进行自定义。 MEAN.IO方法创建的代码更可重用,但根据项目目标可能会更加沉重。我可以看到跨多个MEAN包的冗余bower或节点依赖的可能性。
如果您选择删除自定义程序包,则可以键入
mean uninstall customPackageName
似乎应该有一种方法可以避免一些冗余代码在平均包中重用。目前,文档和教程很少。