gw

generator-webbp

基于angular + yeoman + nodejs + bower + requirejs 构架前端架构,支持本地mock数据(get/post)。简单命令生成项目架构,自动生成router,view,controller等。

Showing:

Popularity

Downloads/wk

3

GitHub Stars

14

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

3

Size (min+gzip)

600.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

generator-webbp Build Status

Yeoman generator

Getting Started

npm install -g yo

Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-webbp from npm, run:

npm install -g generator-webbp

Finally, initiate the generator:

yo webbp

子命令

  • 单步生成controller
yo webbp:controllers detail.about.contact

亮点:可以嵌套,此命令会生成如下文件

|controllers
   |detail
      |about.js
      |contact.js
    detail.js

另外detail.js中会自动加载about.js及contact.js

  • 单步生成views
yo webbp:views detail.about.contact

亮点:可以嵌套,此命令会生成如下文件

|views
   |detail
      |about.html
      |contact.html
    detail.html
  • 单步生成routes
yo webbp:routess detail.about.contact

亮点:可以嵌套,此命令会生成如下文件

|states
  |detail.js

其内容是:

define(['./states', '../cons/simpleCons'],
    function (stateModule, simpleCons) {
      stateModule.config(
          ['$stateProvider', '$urlRouterProvider',
            function ($stateProvider, $urlRouterProvider) {
              $stateProvider.state("detail", {
                abstract: true,
                resolve: {
                  instanceBasicPromise: [ '$stateParams', function( $stateParams){

                  }]
                },
                url: "/detail",
                controller: 'detailController',
                templateUrl: simpleCons.VIEW_PATH + 'detail.html'
              })
              
                .state("detail.about", {
                  url: "/about",
                  views: {
                    detail: {
                      templateUrl: simpleCons.VIEW_PATH + 'detail/about.html',
                      controller: 'detail.aboutController'
                    }
                  }
                })  
              
            }
          ]);
    })

亮点:通过运行此命令,会自动生成 routes(用的是ui-router,目录是states目录),view,controller。有没有觉得很爽的感觉。

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100