npm install marionette-cli#Marionette CLI
Marionette CLI is the command line utility that provides RequireJS/CommonJS/ES6 app structure.
##Install
Run npm install -g marionette-cli or add dependency in your package.json file and run npm install
##Features
* Generate app skeleton
* Generate backbone/marionette files
* Support different module types (RequireJS, CommonJS, ES6)
##Commands
###Set
```
set [options]
Usage: set [options]
Example: mt set rjs mt s rjs
Example:
###New
``
new [options] Create new project. Short - n
Usage: new [options]
Example: mt new mt n
Example: mt n folderName
Example: - will genarate app in folderName folder
Command copying best practices (most stared examples of applications) from github.
####Generated files content
* ES6 file content:`javascript`
export default Marionette.LayoutView.extend({
//stuff
//Doc - http://marionettejs.com/docs/v2.4.4/marionette.layoutview.html
});
more
* CommonJS file content:`javascript`
"use strict";
var LayoutView = Marionette.LayoutView.extend({
//stuff
//Doc - http://marionettejs.com/docs/v2.4.4/marionette.layoutview.html
});
module.exports = LayoutView;
more
* RequireJS file content:`javascript`
define(['marionette'], function (Marionette) {
"use strict";
var LayoutView = Marionette.LayoutView.extend({
//stuff
//Doc - http://marionettejs.com/docs/v2.4.4/marionette.layoutview.html
});
return LayoutView;
});
more
####Projects:
* RequireJS example from David Sulc
* CommonJS example from Sam Saccone
* ES6 example from James Kyle
###Generate
``
Usage: generate [options] [folder]
Generate files for marionette. Short - g
Options:
``
-l --layout [name] Layout
-c --collection [name] Collection
-m --model [name] Model
-r --router [name] Router
-o --object [name] Object or controller
-v --itemView [name] Item view
--collectionView [name] Collection view
--compositeView [name] Composite view
Example: mt generate -l - will create marionette layout file layout.js mt g -l
Example: - the same as above
Example: mt generate -l myName - will create marionette layout file myName.js mt g -l
Example: - the same as above
Example: mt generate -l myName myFolder - will create marionette layout file myName.js in folder myFolder mt g -l myName myFolder
Example: - the same as above
###Using Atom as your IDE?
Get lasy and use MarionetteJS CLI package for atom
###Want to run CLI from your code?
`
var cli = require('marionette-cli/lib/cli');
cli.run(['generate', '--help']);
``