Giter Site home page Giter Site logo

hezhongbin / generator-webbp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cc17/generator-webbp

0.0 2.0 0.0 188 KB

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

JavaScript 97.51% HTML 2.45% CSS 0.04%

generator-webbp's Introduction

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

generator-webbp's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.