Skip to content
Scott B. Wyatt edited this page Aug 8, 2015 · 3 revisions

##Generators

###humpback-api sails generate humpback-api <API_NAME> creates a model and controller for <API_NAME> inside the ./api folder and a humpback counterpart in the ./assets/app/ folder

###humpback-model sails generate humpback-model <MODEL_NAME> creates a model for <MODEL_NAME> inside the ./api/models folder and a humpback counterpart in the ./assets/app/models folder

###humpback-controller sails generate humpback-controller <CONTROLLER_NAME> creates a controller for <CONTROLLER_NAME> inside the ./api/controller folder and a humpback counterpart in the ./assets/app/controllers folder

###humpback-view sails generate humpback-view <[FEATURE/]MODULE_NAME [FILENAME]> creates a humpback view .ejs file inside the ./views as well as creates a default angular controller module and state module inside the ./assets/app/views folder. At lift, Humpback uses grunt to compile the ejs files into html files inside of the ./assets/app/views folder, and then uses grunt HTML2JS to convert those html files into an angular js template file. It also uses sails-linker to automatically inject all the modules so that they are included when the app runs. What this means is that there is an ejs fallback for users/web scrappers that don't run javascript.

For example. I want to create a Profile section for my app, so I run sails generate humpback-view profile. This will create ./views/profile/index.ejs as well as ./assets/app/views/profile/profile.states.js and ./assets/app/views/profile/profile.controllers.js. Now I want to create a notifications section in my app, so I run sails generate humpback-view profile/notifications/notifications index. The 2nd argument is the .ejs/html filename override which might be useful if I want to separate out my app by module.

###humpback-module sails generate humpback-module <MODULE_NAME> creates a module TODO

Clone this wiki locally