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.
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.
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.
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
请发表评论