cordova - IntelliJ IDEA / Webstorm and AngularJS / Ionic -


i love when multiple technologies come produce doozy...

the following angularjs template squawks error in ide ("can't resolve file"). find inspection wildly convenient , don't want turn off.

/my_project/www/templates/logo.html

... <img src="img/logo.png"/>      <<< file @ /my_project/www/img/logo.png ... 

question: how can allow ide intellij idea or webstorm play nice ionic/angularjs/cordova in situation?

note: cannot mark www folder "resources root" , use absolute references because ionic needs relative refs...

or it? there way fix on cordova side of things allow absolute refs? i.e., doesn't break when deploying android (because need prefix file://android_asset/www/)

inspired this answer, ended creating recursive search/replace script in build process. made cordova hook "after_prepare" , used node replace package. can use absolute refs , full benefit of ide... , @ build-time converted relative.

here sample hook file started. don't forget add refs css files or things templateurl in app.js if you're using angular/ionic. , of course don't forget modify platform specifics needs.

#!/usr/bin/env node  var replace = require("replace"); var wwwdir = process.argv[2] + '\\platforms\\android\\assets\\www';  // convert src , href tags relative in index.html + components\* replace({     regex: '(src|href)=([\'"])/+',     replacement: '$1=$2',     paths: [         wwwdir + '\\components',         wwwdir + '\\index.html'     ],     recursive: true,     silent: false }); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -