Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Grunt tasks during Xcode build phase?

I am developing a web application, which includes GruntJS build tasks. I deploy it using Phonegap/Cordova in the Xcode IDE.

I would like to integrate the grunt build process into my Xcode project to simplify running the project. Ideally Xcode should run all the processes that I manually invoke using the Grunt CLI beforehand.

My Gruntfile.js lies within the root Xcode project directory. I have a local grunt install (0.4.0rc4) in node_modules and grunt-cli installed globally.

project
- multiple project dirs ...
- node_modules
- www-src
- www
  project.xcodeproj
  Gruntfile.js

I have tried adding a custom Run script - build phase to my Xcode project with a command as simple as "grunt" which returns "grunt: command not found" during build. Clearly more effort is needed to reference grunt and/or the proper target directory.

like image 940
Gregor Avatar asked Jan 14 '23 12:01

Gregor


1 Answers

Nice setup Gregor :-) I had exact same setup for my previous project. Here is how I setup my custom script in Xcode Build Phases:

cd "${PROJECT_DIR}"
PATH=${PATH}:/usr/local/bin
grunt

Hope this helps you :-)

like image 69
Qorbani Avatar answered Jan 20 '23 16:01

Qorbani