Grunt tasks for building apps with the Aerobatic - single page app hosting, built for front-end developers.
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-aerobatic --save-dev
The "aerobatic" task
In your project's Gruntfile, add a section named
aerobatic to the data object passed into
By default the
index.html page is assume to reside at the root of the repo
and assets are built to a top-level directory such as
The directory structure would be structured along these lines:
.├── Gruntfile.js│ index.html├── css│ └── styles.css├── js│ └── app.js├── images├── build│ └── styles.min.css│ └── app.min.css
URL paths would then look like so:
Allows you to override the base directory for URLs served in both debug and release builds.
For example a common convention is for the
index.html page all css, js, etc. to live
src directory at the root of the repo. Built assets may be written to a
.├── Gruntfile.js├── src│ └── index.html│ ├── css│ │ └── styles.css│ ├── js│ │ └── app.js│ ├── images├── build│ └── styles.min.css│ └── app.min.css
aerobatic options for this structure would be this:
options:base:debug: '/src'release: '/build'
index.html file, the assets URLs would omit the leading
/build paths since
they are implicitly treated as the root.
Object Default value:
Allows you to override the names of the host pages for your app. For basic apps
index page is required which serves as the entry point for your single
page application. For apps with OAuth an additional
should be specified. Read more in the OAuth documentation.
The "deploy" target
deploy target deploys the current local sources as a new version. By default this new version will only be
staged in production, but not yet receiving live traffic. To direct live traffic to the new version you log into
your Aerobatic app dashboard and configure the traffic control rules to specify this version should receive
some or all of the traffic. The grunt log output will include a preview URL that will force the new version to be used
so you can immediately see your changes live in production without impacting real users.
If you just want to push your changes to the live site and bypass traffic control
configuration, you can specify the
Specifies the files that should be deployed. Typically you will use the output of other grunt tasks that have built the assets for the production environment, i.e. grunt-contrib-uglify, grunt-contrib-sass, etc.
When deploying, force the new version to take 100% of live traffic immediately. Useful when you are just getting started and the risks of bypassing the staging process is low or you if that's just the way you roll.
--cowboy - Override the default setting specified in the Gruntfile.
--name - The name of the new version. Defaults to an auto-generated timestamp.
--message - Optional short message describing the version.
--open - Launch a browser to the version preview URL upon successful deploy.
It is suggested that you configure a grunt alias task called
deploy that builds
your deployment assets then invokes
grunt deploy --cowboy --name '1.2.10' --message 'New messaging feature'
The "sim" target
sim target is used to run a local simulator expressjs server which allows
development of front end assets locally while the main app entry page is
hosted in the cloud. By working in a fully integrated mode you are much more
likely to uncover integration issues while you build your app rather than
post-deployment. Generally you will keep the simulator running the whole time
you work so your browser always reflects your latest changes.
In simulator mode you would work off a URL in the format:
The aerobatic platform detects the
sim=1 and automatically repoints your scripts, stylesheets, templates, images, etc. to
The port number to run the simulator on.
Automatically adds the livereload script in the HTML source of the development URL. Designed to be used in conjunction with the grunt-contrib-watch task.
--open - Launch a browser to the simulator URL. Useful the first time you run
grunt sim, after that you may choose to simply refresh the
--release - Run the simulator in release mode to test the built minified assets locally before deploying.
Watch and Reload
One of the powerful workflows grunt enables is watching your filesystem for
changes, performing any necessary pre-processing, and automatically
refreshing your browser. The aerobatic sim task can work in parallel with the
capabilities of the
watch to work in tandem, the suggested configuration is
to define an alias task called
sim which runs both tasks with an extra
option specified on
sync option prevents
sim from blocking grunt
from running the subsequent watch task. When grunt is killed, both the watch and
the express simulator server are terminated together.
grunt sim --open