• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

doronsever/generator-gulp-angular-subtask: A helper generator for generator-gulp ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

doronsever/generator-gulp-angular-subtask

开源软件地址(OpenSource Url):

https://github.com/doronsever/generator-gulp-angular-subtask

开源编程语言(OpenSource Language):

JavaScript 83.1%

开源软件介绍(OpenSource Introduction):

generator-gulp-angular-subtask

A helper generator for gulp-angular generator

*IMPORTANT NOTE: This subtask generator version was updated to fit generator-gulp-angular >= V0.11. **

If you are using previous versions please check at previous releases

Getting Started

Installation

  1. Create a project using generator-gulp-angular
  2. After you have a working project, install the generator-gulp-angular-subtask
npm install -g generator-gulp-angular-subtask
  1. Run yo gulp-angular-subtask and set your defaults
  2. Create subtasks following the examples below

Why should i use it?

For the time been, the great gulp-angular generator does not support sub tasks like controllers and directives.
So i decided to build a helper generator that creates those tasks for me and thought about sharing it.

This project will be deprecated when the team decide to support this issue.

Usage:

I currently support these sub tasks:

Options

To see the options available you can always use the help option on a task

yo gulp-angular-subtask:[SUBTASK] --help

Note that script-type, style-type and html-type will override your default option for the current command, meaning it is not permanently.

These are the options available

  • --dest : Set a destination where to save the file
  • --component : Set the destination to be under the component library
  • --bundle : Create the task's file under a specific bundle instead of the file name
  • --script-type : Generate Coffee or JavaScript template file
  • --service-value: Set value for the value / constant service [value, constant]
  • --style-type : Generate a style file based on a type {scss, sass, less, styl} [style]
  • --html-type : Generate html or jade partial [partial]
  • --skip-test : Generate a task without it spec file

Please note that for the time been, gulp-angular does not support coffescript. I'm using my IDEA's file watcher to generate a corresponding js file.
Also note that you can combine multiple options together.

Examples

Default: { language: 'js', style: 'css', html: 'html' }

Controllers

  • To Create a controller

    yo gulp-angular-subtask:controller user
    

    Produces

src/app/user/controllers/user-controller.js

  • Creating a controller under the components library

    yo gulp-angular-subtask:controller navbar --component
    

    Produces

src/app/components/navbar/controllers/navbar-controller.js

  • Creating a coffee script controller

    yo gulp-angular-subtask:controller user --script-type=coffee
    

    Produces

src/app/user/controllers/user-controller.coffee

  • Creating a controller under user specific library

    yo gulp-angular-subtask:controller user --dest=specific/location
    

    Produces

src/specific/location/user-controller.js

  • Creating a user details controller under the user bundle

    yo gulp-angular-subtask:controller user-details --bundle=user
    

    Produces

src/app/user/controllers/user-details-controller.js

  • Combining options

    yo gulp-angular-subtask:controller user-details --component --bundle=user --script-type=coffee
    

    Produces

src/app/component/user/controllers/user-details-controller.coffee

Directives

  • To Create a Directive

    yo gulp-angular-subtask:directive user
    

    Produces

src/app/user/directives/user-directive.js

  • Creating a directive under the components library

    yo gulp-angular-subtask:directive navbar --component
    

    Produces

src/app/components/navbar/directives/navbar-directive.js

  • Creating a coffee script directive

    yo gulp-angular-subtask:directive user --script-type=coffee
    

    Produces

src/app/user/directives/user-directive.coffee

  • Creating a directive under user specific library

    yo gulp-angular-subtask:directive user --dest="specific/location"
    

    Produces

src/specific/location/user-directive.js

  • Creating a user-details directive under the user bundle

    yo gulp-angular-subtask:directive user-details --bundle=user
    

    Produces

src/app/user/directives/user-details-directive.js

  • Combining options

    yo gulp-angular-subtask:directive user-details --component --bundle=user --script-type=coffee
    

    Produces

src/app/component/user/controllers/user-details-controller.coffee

Factories, Services and Provides

These sub tasks works exactly like the controllers and directives sub tasks. Please take a look at their examples to understand how to use their options.

  • Creating a Factory

    yo gulp-angular-subtask:factory user-details
    

    Produces

src/app/user-details/factories/user-details-factory.js

  • Creating a Service

    yo gulp-angular-subtask:service user-details
    

    Produces

src/app/user-details/services/user-details-service.js

  • Creating a Provider

    yo gulp-angular-subtask:provider user-details
    

    Produces

src/app/user-details/providers/user-details-provider.js

Values, Constants

  • Creating a Value

    yo gulp-angular-subtask:value user-id --bundle=user
    

    Produces

src/app/user/values/user-id-value.js

  • Creating a Constant with value from the cmd

    yo gulp-angular-subtask:constant user-id --bundle=user --service-value=4343434
    

    Produces

src/app/user/constants/user-id-constant.js with value of 4343434

Filters

These sub task works exactly like the controllers and directives sub tasks. Please take a look at their examples to understand how to use their options.

  • Creating a filter

    yo gulp-angular-subtask:filter myFilter
    

    Produces

src/app/user/filters/myFilter-filter.js

Styles

  • Creating a css file

    yo gulp-angular-subtask:style user
    

    Produces

src/app/user/styles/user.css

  • Creating a scss style

    yo gulp-angular-subtask:style user --style-type="scss"
    

    Produces

src/app/user/styles/user.scss

Partials

  • Creating a partial

    yo gulp-angular-subtask:partial user
    

    Produces

src/app/user/partials/user.html

  • Creating a jade partial

    yo gulp-angular-subtask:partial user --html-type=jade
    

    Produces

src/app/user/partials/user.jade

License

MIT




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
duojs/gulp: Use gulp plugins in duo without any extra work.发布时间:2022-06-21
下一篇:
sindresorhus/gulp-tar: Create tarball from files发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap