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.

Commands from Modules

Don't see the command you are looking for here? Chances are good that command is from another module. Mimosa modules can add commands to your project, mimosa-bower is a good example.

Mimosa Commands

A set of commands come with Mimosa and that are available no matter what modules are included in your project

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.
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.

new

$ mimosa new nameOfApplicationHere

The new command will kick off a series of prompts to choose a set of technologies to get you started with a Mimosa application.

Mimosa gets the new command from the newmimosa module. For details on what sort of assets it gives you, check out that module's GitHub repository.

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.

Using the -s/--server flag with mimosa watch will indicate to any server related modules that they need to invoke their server-related code. mimosa-server for example can start an embedded Express or start your node.js server

Mimosa does not require a server. You may simply not need one (static site?) or you may have your own non-node.js server that Mimosa cannot start for you. When running a non-node.js server, the major consideration is the watch.compiledDir. The output of asset compilation might need to redirected to another folder where the server lives.

watch: {
  compiledDir: "../server/public"
}
$ mimosa watch --server
$ mimosa watch -s

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 any optimization modules you are using will perform their optimizations.

$ mimosa watch --optimize
$ mimosa watch -o

Minify Assets (-m/--minify)

Start mimosa watch with the --minify flag turned on and any minification modules you have enabled will minify their assets.

$ mimosa watch --minify
$ mimosa watch -m

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

Flags are cumulative, so both the minify and optimize flags can be used at the same time to both minify and optimize your codebase.

$ 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 - 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. This will signal any optimization modules you are using that optimization is to be performed.

$ 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)

Using --minify and --optimize together signals both minification and optimization modules to perform their tasks.

$ 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

See the repository for the bower module to get details on the bower commands.

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!

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.

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

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.