Commands

Interact with Mimosa via the command line with a large set of commands and options

Each command has a section dedicated to it below, but here is a quick list of the available non-module commands. Most commands have flags that influence the behavior of the command. Read more about those below.

Command Options Description
new [name] [-d/--defaults] Creates a new project skeleton with sample code.
watch [-s/--server] [-c/--clean] [-C/--cleanall] [-d/--delete] [-o/--optimize] [-m/--minify] [-P/--profile] Builds the project and continues watching project files to build them on-the-fly.
clean [-f/--force] [-C/--cleanall] [-P/--profile] Cleans the Mimosa generated assets.
build [-C/--cleanall] [-o/--optimize] [-m/--minify] [-p/--package] [-i/--install] [-e/--errorout] [-P/--profile] Builds the project and exits.
config Provides a mimosa-config when one isn't present, and writes a fully documented version for reference.
bower [-P/--profile] Runs bower install.
bower:clean [-c, --cache], [-P/--profile] Remove all of the mimosa-bower installed dependencies from their target directories.
skel:new <skeletonName> [installFolder] Creates a new project from an existing skeleton.
skel:list List all skeletons.
skel:search <keyword> Search for skeletons using keywords.
All Commands [-D, --mdebug], [--help] These flags are available for all commands.

Mimosa's module features have their own set of commands prefixed with mod:. Read about them on the Module's page.

new

One way to get started with Mimosa is to use it to create a new application/project structure.

$ mimosa new nameOfApplicationHere

The new command will kick off a series of prompts to choose meta-languages, a templating library, a server, and a server templater. Mimosa will then create a directory using the name provided. Inside that directory Mimosa will populate an application skeleton. The assets directory will contain some example code for the chosen selections. At the root of the project will be a bower.json file that will be used to pull in jQuery and RequireJS when you first start Mimosa.

If a server was chosen, Mimosa will include the bare essentials for that server selection, application, and the server code will be delivered in the chosen transpiler language.

Mimosa will also provide some starter views for an index page in the chosen view templating language.

If no server is chosen, Mimosa can handle serving assets. Mimosa provides some configuration options for an embedded Express server so not having a server is a little less painful than it would be otherwise.

The project directory will also contain Mimosa's configuration file which will contain at a minimum a modules array. If a JavaScript transpiler, a CSS preprocessor or a micro-templating library were chosen, the modules for those will be added to the modules array and installed inside the project as part of creating the project. A documented version of the config will also be created. It will contain all the information for each of the modules used to build the project along with defaults.

Pick the defaults (-d/--defaults)

Should Mimosa's defaults (CoffeeScript, Handlebars, Stylus, Express, Jade) suffice, the prompts can be bypassed by providing a --defaults flag.

$ mimosa new nameOfApplicationHere --defaults
$ mimosa new nameOfApplicationHere -d

$ mimosa new foo

Determining system capabilities...

Mimosa will guide you through technology selection and project creation. For all of the selections, if your favorite is not an option, you can add a GitHub issue and we'll look into adding it.

If you are unsure which options to pick, the ones with asterisks are Mimosa favorites. Feel free to hit the web to research your selections, Mimosa will be here when you get back.

To start, please choose your JavaScript transpiler:

1) Coco - https://github.com/satyr/coco
2) (*) CoffeeScript - http://coffeescript.org/
3) Iced CoffeeScript - http://maxtaco.github.com/coffee-script/
4) LiveScript - http://gkz.github.com/LiveScript/
5) None (Raw JavaScript)
6) TypeScript - http://www.typescriptlang.org
: 2

You chose (*) CoffeeScript - http://coffeescript.org/.

Choose your CSS preprocessor:

1) LESS - http://lesscss.org/
2) None (Raw CSS)
3) SASS - http://sass-lang.com/
4) (*) Stylus - http://learnboost.github.com/stylus/
: 4

You chose Stylus - http://learnboost.github.com/stylus/.

Choose your micro-templating language:

1) (*) Dust - https://github.com/linkedin/dustjs/
2) Embedded CoffeeScript Templates (ECO) - https://github.com/sstephenson/eco
3) Embedded JavaScript Templates (EJS) - https://github.com/visionmedia/ejs
4) (*) Handlebars - http://handlebarsjs.com/
5) Hogan - http://twitter.github.com/hogan.js/
6) HTML - Just Plain HTML Snippets, no compiling
7) Jade - http://jade-lang.com/
8) LoDash - http://lodash.com/docs#template
9) None (No Templating)
10) Ractive - http://ractivejs.org
11) Underscore - http://underscorejs.org/#template
: 5

You chose Hogan - http://twitter.github.com/hogan.js/.

Choose your server technology:

1) None - You either don't need a server or you have one already that you will manage separate from Mimosa.
2) Mimosa's Embedded Server - http://mimosa.io/server.html#mimosas, this is less powerful than having your own, but may be sufficient for trivial websites.
3) (*) Express - http://expressjs.com/
4) Express w/socket.io - http://expressjs.com/ + http://socket.io/
5) Hapi - http://hapijs.com/
: 3

You chose (*) Express - http://expressjs.com/.

And finally choose your server view templating library:

1) (*) Jade - http://jade-lang.com/
2) Hogan - http://twitter.github.com/hogan.js/
3) Plain HTML
4) Embedded JavaScript Templates (EJS) - https://github.com/visionmedia/ejs
5) Handlebars - http://handlebarsjs.com/
6) Dust - http://linkedin.github.io/dustjs/
: 1

You chose (*) Jade - http://jade-lang.com/.

Creating and setting up your project...

23:20:05 - Installing application and Mimosa development node modules. This may take a few seconds.
23:20:09 - New project creation complete! Execute 'mimosa watch' from inside your project's directory to monitor the file system. Then start coding!

watch

Mimosa will watch the configured watch.sourceDir, by default the assets directory. When files are added, updated, or deleted, Mimosa's will process the files through the configured Mimosa modules.

$ mimosa watch

Serve Assets (-s/--server)

Start Mimosa with the server flag if assets need to be served.

$ mimosa watch --server
$ mimosa watch -s

By default, using functionality provided by the server module, Mimosa will run a piece of code located at server.path. If Mimosa was used to create the project, and a server was chosen, a server.js (.iced/.coffee/.ls/.coco) file will be at the project's root. Mimosa will run the startServer function in this file and pass it the full mimosa-config and a callback function that must be executed.

Mimosa's embedded (non-extendable) Express server can be used by changing the server.defaultServer.enabled configuration to true. If no server was chosen during project creation, this setting will be set.

$ mimosa watch --server
20:31:54 - Info - Did not find compiled directory public, so making it for you
20:31:54 - Info - Starting Bower install...
20:31:54 - Info - mimosa-bower created file assets/javascripts/vendor/jquery/jquery.js
20:31:54 - Info - mimosa-bower created file assets/javascripts/vendor/requirejs/require.js
20:31:54 - Info - Cleaned temp bower output directory .mimosa/bower/bower_components
20:31:54 - Info - Watching assets
20:31:54 - Success - Compiled/copied public/javascripts/main.js
20:31:54 - Success - Compiled/copied public/javascripts/app/example-view.js
20:31:54 - Success - Compiled/copied public/javascripts/vendor/requirejs/require.js
20:31:54 - Success - Compiled/copied public/javascripts/vendor/jquery/jquery.js
20:31:54 - Success - Compiled/copied public/javascripts/app/template/handlebars-helpers.js
20:31:55 - Success - Compiled/copied public/stylesheets/style.css
20:31:55 - Success - Compiled/copied public/javascripts/templates.js
20:31:55 - Success - Compiled/copied public/javascripts/vendor/handlebars.js
20:31:55 - Success - Mimosa is starting your server: server.coffee
Express server listening on port 3000 in development mode
   info - socket.io started

Clean Compiled Assets First (-c/--clean)

Use the --clean flag to clean the compiled directory before watching starts. This forces a recompile and recopy of all assets.

$ mimosa watch --clean
$ mimosa watch -c

Clean Compiled Assets and the .mimosa Cache (-C/--cleanall)

Use the --cleanall flag to delete the .mimosa directory before watching starts. This forces modules, like mimosa-bower, to reprocess anything that may have been cached.

This also includes a clean as with the --clean flag above.

$ mimosa watch --cleanall
$ mimosa watch -C

Delete Compiled Directory First (-d/--delete)

More drastic than the clean flag, the --delete flag will remove the compiled directory entirely. This is the same as the --force option for the clean command below.

$ mimosa watch --delete
$ mimosa watch -d

Serve Optimized Assets (-o/--optimize)

Start mimosa watch with the --optimize flag turned on and by default, via the require module, Mimosa will optimize the codebase on start-up and with every file change. See the optimization tab to read more about Mimosa's default optimization options.

$ mimosa watch --optimize
$ mimosa watch -o

Minify Assets (-m/--minify)

Start mimosa watch with the --minify flag turned on and Mimosa will, by default, via the minify module, use Uglify2 to compress JavaScript files after they are compiled and before they are written. The minify module will also single-line CSS.

$ mimosa watch --minify
$ mimosa watch -m

Minify and Optimize Assets (-mo/--minify --optimize)

When combined, the --minify and --optimize options provide more control over the application's minification strategy. Check out the Minify + Optimize section of the Optimization tab to learn more.

$ mimosa watch --minify --optimize
$ mimosa watch -mo

Use a Profile (-P/--profile)

Follow the --profile flag with the name of a profile, and Mimosa will use that profile to override the mimosa-config contained in the profile. See the profiles section of the Utilities page for more information on profiles.

$ mimosa watch --profile nameOfProfile
$ mimosa watch -P nameOfProfile

clean

mimosa clean will wipe out any file from the watch.compiledDir that is currently in the watch.sourceDir. Any assets in the watch.compiledDir that are not in the watch.sourceDir are left alone in case they were placed there purposefully. Mimosa makes a pass to clean out the files, and once done, it makes a pass to clean out any directories that were emptied.

$ mimosa clean

Remove the .mimosa Cache (-C/--cleanall)

Use the --cleanall flag to delete the .mimosa directory as part of the clean.

$ mimosa watch --cleanall
$ mimosa watch -C

Force Asset Deletion (-f/--force)

Because the clean command will not remove anything in watch.compiledDir that isn't in watch.sourceDir, Mimosa may leave behind code. If mimosa watch is running and a file is deleted or renamed, Mimosa cleans out the compiled version of that file, but if Mimosa is not running and a file is deleted or removed, Mimosa has no way of knowing the files left behind are safe for cleaning.

When included, the --force flag will remove the entire compiled directory and all of its contents, no questions asked.

$ mimosa clean --force
$ mimosa clean -f

$ mimosa clean
20:40:04 - Info - mimosa-live-reload: removed live reload client.
20:40:04 - Success - Deleted file public/javascripts/main.js
20:40:04 - Success - Deleted file public/stylesheets/style.css
20:40:04 - Success - Deleted file public/javascripts/app/example-view.js
20:40:04 - Success - Deleted file public/javascripts/vendor/handlebars.js
20:40:04 - Success - Deleted file public/javascripts/templates.js
20:40:04 - Success - Deleted file public/javascripts/app/template/handlebars-helpers.js
20:40:04 - Success - Deleted file public/javascripts/vendor/jquery/jquery.js
20:40:04 - Success - Deleted file public/javascripts/vendor/requirejs/require.js
20:40:04 - Success - Deleted empty directory public/javascripts/vendor/requirejs
20:40:04 - Success - Deleted empty directory public/javascripts/vendor/jquery
20:40:04 - Success - Deleted empty directory public/javascripts/app/template
20:40:04 - Success - Deleted empty directory public/javascripts/vendor
20:40:04 - Success - Deleted empty directory public/javascripts/app
20:40:04 - Success - Deleted empty directory public/stylesheets
20:40:04 - Success - Deleted empty directory public/javascripts
20:40:04 - Success - public has been cleaned.

Use a Profile (-P/--profile)

Follow the --profile flag with the name of a profile, and Mimosa will use that profile to override the mimosa-config contained in the profile. See the profiles section of the Utilities page for more information on profiles.

$ mimosa clean --profile nameOfProfile
$ mimosa clean -P nameOfProfile

build

Use mimosa build to build your application and exit. mimosa build is also used when creating deployable versions of a project. This command executes a clean before it does anything, so a clean version of the application is built.

$ mimosa build

Remove the .mimosa Cache (-C/--cleanall)

Use the --cleanall flag to delete the .mimosa directory before building. This forces modules, like mimosa-bower, to reprocess anything that may have been cached.

$ mimosa watch --cleanall
        $ mimosa watch -C

Optimized Build (-o/--optimize)

If you want to build and generate optimized output, provide an --optimize flag. See the Optimization page for more information on optimization.

$ mimosa build --optimize
$ mimosa build -o

$ mimosa build --optimize
20:46:18 - Info - Beginning build
20:46:18 - Info - Did not find compiled directory public, so making it for you
20:46:18 - Info - No Bower installs needed.
20:46:18 - Success - Compiled/copied public/javascripts/main.js
20:46:18 - Success - Compiled/copied public/javascripts/app/example-view.js
20:46:18 - Success - Compiled/copied public/javascripts/app/template/handlebars-helpers.js
20:46:18 - Success - Compiled/copied public/javascripts/vendor/requirejs/require.js
20:46:18 - Success - Compiled/copied public/javascripts/vendor/jquery/jquery.js
20:46:19 - Success - Compiled/copied public/stylesheets/style.css
20:46:19 - Success - Compiled/copied public/javascripts/templates.js
20:46:19 - Success - Compiled/copied public/javascripts/templates.js
20:46:19 - Success - Compiled/copied public/javascripts/vendor/handlebars.js
20:46:19 - Success - Finished build

Minify Assets (-m/--minify)

To build minified code, run the build command with the --minify flag. If the minify module is in use, Mimosa will use Uglify2 to compress JavaScript files and will single-line CSS.

$ mimosa build --minify
$ mimosa build -m

Minify and Optimize Assets (-mo/--minify --optimize)

Need a bit more control over a project's minification strategy? See the page on optimization to see the benefit of using --minify and --optimize together.

$ mimosa build --minify --optimize
$ mimosa build -mo

Package Application (-p/--package)

Provide a --package flag and Mimosa will invoke any installed packaging modules. Mimosa doesn't come with any packaging modules by default, but modules like mimosa-web-package are available and can be added to an application by simply adding the module name to the mimosa-config modules array.

$ mimosa build --package
$ mimosa build -p

Install Application (-i/--install)

Provide a --install flag and Mimosa will invoke any configured install modules. Mimosa doesn't come with any installation modules, but this paves the way for those sorts of modules to be used.

$ mimosa build --install
$ mimosa build -i

Force Erroring Out (-e/--errorout)

Provide a --errorout flag and the build command will error out if it encounters any compiler (js, css, template) errors. Without this flag set, build compiles everything and gracefully exits.

$ mimosa build --errorout
$ mimosa build -e

Use a Profile (-P/--profile)

Follow the --profile flag with the name of a profile, and Mimosa will use that profile to override the mimosa-config contained in the profile. See the profiles section of the Utilities page for more information on profiles.

$ mimosa build --profile nameOfProfile
$ mimosa build -P nameOfProfile

bower

bower provide one off access to Bower installs without kicking off watchor build.

bower:install <names,of,modules> [-d/--savedev]

bower:install will install one to many modules into your application and save the new modules to the dependencies array of the bower.json. To save to the devDependencies, add a [-d/--savedev] flag. You can even use version numbers when installing modules. Example: mimosa bower:install backbone,underscore,jquery#1.8.1

bower:clean [-c/--cache]

bower:clean will remove all of the Bower installed dependencies from their target directories in the vendor folder. It will also clean up any Bower package related folders that then become empty. Finally it will clean up the bower.bowerDir.path folder, removing all the temporary assets.

bower:clean --cache, in addition to cleaning up installed dependencies, will also clean the Bower cache. This often is necessary when Bower updates, or if packages get updated without new versions.

Skeletons are starter apps that include things like MVC libraries (Backbone or Angular), CSS libraries (Bootstrap or Foundation), boilerplate assets, a notional file structure and possibly integration with things like Bower or Testem. Mimosa is admittedly very light on skeletons at the moment. About that...

Creating a new skeleton has a dependency on git being available at the command line.

Mimosa needs skeletons! Learn how to contribute!

As of version 0.14.6, Mimosa's skeleton module is a default Mimosa module and its three commands are immediately available.

skel:new [nameOfSkeleton] [directory]

This command will install the named skeleton in the directory provided. If the directory is not provided, it will install the skeleton in the current directory.

skel:search [searchTerm]

This command will search the registry for any skeletons possessing the searchTerm as a keyword.

skel:list

This command will list all skeletons.

config

$ mimosa config

To use Mimosa with an existing project, use this command to copy the default mimosa-config.js file into the current directory. Some configuration will likely need to be updated for the project. This command will also create a mimosa-config-documented.coffee. This will allow modifications to occur to the mimosa-config while keeping the defaults file for reference.

$ mimosa config
20:57:19 - Success - Copied mimosa-config-documented.coffee into current directory.
20:57:19 - Success - Copied mimosa-config.js into current directory.

-h/--help

Mimosa includes extensive help documentation for each command. Use --help or -h to bring up help.

$ mimosa --help
$ mimosa new --help
$ mimosa [command] --help

$ mimosa new --help

Usage: new [options] [name]

Options:

-h, --help output usage information
-d, --defaults bypass prompts and go with Mimosa defaults (CoffeeScript, SASS, Handlebars)
-D, --mdebug run in debug mode

The new command will take you through a series of questions regarding what JavaScript meta-language, CSS meta-language, micro-templating library, server and server view technology you would like to use to build your project. Once you have answered the questions, Mimosa will create a directory using the name you provided, and place a project skeleton inside of it. That project skeleton will by default include a basic application using the technologies you selected.

$ mimosa new [nameOfProject]

If you wish to copy the project skeleton into your current directory instead of into a new one leave off the name.

$ mimosa new

If you are happy with the defaults (CoffeeScript, Stylus, Handlebars, Express, Jade), you can bypass the prompts by providing a 'defaults' flag.

$ mimosa new [name] --defaults
$ mimosa new [name] -d

-D/--mdebug

All Mimosa commands have a debug mode that will print detailed logs to the console for everything Mimosa is doing. As you'll find out the first time you execute a Mimosa command with the --mdebug flag, Mimosa logs quite a bit of what it does, so this is only useful when doing deep debugging, it is not something to use regularly just to see what Mimosa is up to.

$ mimosa [command] --mdebug
$ mimosa [command] -D

node.js flags

Mimosa will take and use an assortment of node.js process flags. These flags are the same as the ones that would be used when executing node directly. The available node pass-through flags are --nolazy, --debug, --debug-brk, -gc, --expose-gc, --gc-global, --harmony, --harmony-proxies, --harmony-collections, --harmony-generators, --prof.