Livereload undoes replacements in my hook?


#1

I am using an “after_prepare” hook similar to the Replace Text Depending on Environment hook discussed in this blog post: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/

Here is my hook: https://gist.github.com/jbeuckm/3064e638b1cad5a5c38b

Running or emulating the app without livereload, the strings are replaced and my app works as intended. When I livereload, the console shows logs from my hook, but the staged javascript files do not have the replacement. How can I make the hook function normally for livereload?

I am replacing URLs that will be proxied for livereload. If there is a better way than this hook, could you point me to it?


#2

Hmm, I tested out a hook and it seems to work fine for me.
What are you editing with your hook?
Could you provide a sample project on github for me to checkout?


#3

Ionic 1.2.5 / Cordova 4.0.0 / OSX 10.10.4 / node v0.10.33

I made a quick demo project and my hook is not working with or without livereload. Hopefully this can help illuminate my hooks understanding. Thanks!


#4

My hook replaces a given tag with a specified URL in the generated javascript files in eg. platforms/ios/www/js. It seems like the hook is working but then the files are overwritten again in the case of livereload.

Did you have a chance to look at the sample project?