generator-fish
AKFish's generator
Installation
First, install Yeoman and generator-fish using npm (we assume you have pre-installed node.js).
npm install -g yonpm install -g generator-fish
Then generate your new project:
yo fish
Usage
In your project folder, run:
yo fish
Then follow the instructions.
Select tasks via CLI argument:
yo fish --coffee --mocha
Or run in standalone mode:
yo fish:coffee
Supported gulp tasks:
- coffee
- mocha
- es6(babel)
- browserify
- watch
- clean
- copy
(Optional) You can override configurations with CLI arguments passed to gulp
command.
Run:
yo fish:cli
To configure CLI mapping.
Getting To Know Yeoman
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. Feel free to learn more about him.
Development
Add New Task
fish:fish
generator in generator-fish
project folder:
Run the internal yo fish:fish
generators/#new#/index.js
Modify the generated 'use strict';var yeoman = ;var chalk = ;var Fish = ; moduleexports = Fish;
When running, the prompts will generate props
in its 'flatten' form:
src: '' dst: '' // other fields
When stored to gulpconfig.json
under the task's namespace, fields other than generic and private ones will be moved to opts
field.
src: '' dst: '' // other fields opts: // other fields
The opts
field will be used as gulp plugin options.
Notes:
- Generic questions will be asked before custom questions:
taskName
src
, toggled byignoreSrc
dst
, toggled byignoreDst
sourceMap
, toggled bysupportSourceMap
- Questions with
_
as prefix in their names are private. - Special custom prototype methods:
_doPrompt
- called right afterthis.props
is set but before it's stored togulpconfig
_doWriting
- called aftergulpfile.coffee
,gulpconfig.json
and task templates are written_doInstall
- called afterfish:app
and task's dependencies are installed
generators/#new#/templates/task.coffee
Modify the generated A typical task.coffee
should be like this:
# require dependencies = cfg = config"name:" # gulp.task
- It's a template file with
this.props
as its parameters - It should expose a function that takes
profile
name as the only option - Following objects are exposed to global in
gulpfile.coffee
:gulp
heap
-gulp-heap
config
- all configurations
- Task specific configurations are stored in
config[name:profile]
License
MIT © akfish