Using Grunt to Automate MobileFirst/Hybrid Builds

This post is more than 2 years old.

When working with MobileFirst and hybrid mobile applications, any changes to your web assets requires running both a build and deploy to see your changes. The command line makes this easy by letting you combine the calls into one (mfp bd), but while developing, it may be a pain to constantly run this. So for fun, I wrote the following Grunt script.

module.exports = function(grunt) {

		pkg: grunt.file.readJSON('package.json'),
				cmd:'mfp bd'
			announce: {
				cmd:'say "All tasks complete" --voice=Vicki'

	grunt.registerTask('default', ['watch']);


Basically it just watches for changes to the common folder and then executes the mfp command to run bd. When done, it uses the Mac "say" program to speak which is totally necessary for the proper execution of this program! (Ok, it is totally not necessary and those of yo u on PC should remove that part.)

Since build/deploy can take about 20 seconds, I use the interrupt option to kill an existing bd process. Let me know if this is helpful in the comments below!

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by KingKong posted on 3/26/2015 at 2:05 PM

I have to try this