Mat*_*ood 16 javascript angularjs yeoman
我知道我可以删除代码和文件; 但是,有没有办法在自耕农中删除生成的路线 - 在类似的自动命令中有角度?
例如yo angular:route myroute
,你是如何生成它的
我将运行哪些cmd行代码来删除,回滚或删除路径的这个脚手架?
我认为没有这样做的命令.
我阅读了关于生成器和子生成器的文档(http://yeoman.io/generators.html#writing-your-first-generator),我找不到任何有关删除进程的信息.
我也读到发电机API文档(http://yeoman.github.io/generator/actions.html),并有类似的选项copy
,directory
,read
和write
,但仍然没有有关删除.所以我认为甚至不可能为这些生成器编写自己的命令.
来自Rails背景,即使我试图删除路线,但似乎没有任何方法这样做.我查看了文档.并且似乎没有任何计划添加iy.
无论如何,当我们生成文件时,我们会看到生成了哪些文件,所以我们所要做的就是删除它们.
yo angular:route route1
创建3个文件
app/scripts/controllers/route1.js (controller)
app/views/route1.html (view)
app/test/spec/controllers/route1.js (testing the controller)
Run Code Online (Sandbox Code Playgroud)
对于其他发电机:
yo angular:controller user app/scripts/controllers/user.js
yo angular:directive myDirective app/scripts/directives/myDirective.js
yo angular:filter myFilter app/scripts/filters/myFilter.js
yo angular:view user app/views/user.html
yo angular:service myService app/scripts/services/myService.js
yo angular:decorator serviceName app/scripts/decorators/serviceNameDecorator.js
yo angular:controller user --coffee app/scripts/controller/user.coffee
Run Code Online (Sandbox Code Playgroud)
测试也是沿着侧面生成的.
这是我一直在使用的 shell hack。
$ yo angular:controller testcontroller
create app/scripts/controllers/testcontroller.js
create test/spec/controllers/testcontroller.js
$ rm -v `yo angular:controller testcontroller 2>&1 | awk '{print $2}'`
app/scripts/controllers/testcontroller.js
test/spec/controllers/testcontroller.js
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7208 次 |
最近记录: |