Usage of npm packages in cordova / phonegap -
i’m trying add package cordova project using npm, either i’m doing terribly wrong or i’m not getting way should work… i’m using latest version of cordova (v3.5.0). have created application:
cordova create testapp cd testapp cordova platform add android cordova run android
everything works perfectly, , app appears on android device. want add package ‘pako’ app: https://github.com/nodeca/pako. i’m still in same directory (see above) , enter “npm install pako”. package installed in “/node_modules/”.
however, when build application android (cordova build android / cordova run android / cordova prepare), none of installed packages (in “/node_modules/” directory) copied platform specific folder “platforms/android/….”. in other words, how use npm package in cordova / phonegap application? shouldn’t package copied automatically cordova cli right platform?
is possible @ all? or have create manual build script using grunt example when want use npm packages? since can’t find examples, have idea i’m on wrong track, if has little hint me in right direction, grateful.
thanks in advance!
adding installed modules not want because might contain other dependencies not used in application (like testing tools or grunt tasks). while can use npm download dependencies , keep them date, still need include them manually in app.
grunt , grunt-contrib-copy (if want separate files) or grunt-contrib-concat (if want single file, better performance) 1 solution. 1 browserify, has support npm modules built in.
Comments
Post a Comment