How to run Grunt tasks during Xcode build phase?

淺唱寂寞╮ 提交于 2019-12-14 03:42:08

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/14315648/how-to-run-grunt-tasks-during-xcode-build-phase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!