Cord hook

On the Cordoba website, you can see a long list of hooks in alphabetical order, but what is the correct order in which they are started and executed?

I am trying to add a cordova.js script to the index.html head file before building / compiling.

What happens first between before_build and before_compile and why? What is the difference between the terms build and compile here?

Does build copy all assets to compile platform code? So should my hook be in the before_build directory?

Please confirm or correct me if I am wrong.

The correct order of hooks will be useful for everyone, as the documentation is unclear :)

EDIT:

Can cordova-cli automatically add a cordova.js script for me in case it is missing? Since I tested the hook, and even if it does not work, the script is already present in the html file.

+5
source share
1 answer

Compilation is the initial step of compilation, and preparation is when Cordoba makes all copies of preferences and assets. Build is a shortcut to launch both of them. You can see that this is the order in which the hooks are launched. (Tested on Cordoba 5.4.0)

In the assembly of Cordoba:

 before_build before_prepare after_prepare before_compile after_compile after_build 

In Cordoba get ready:

 before_prepare after_prepare 

On the compilation of Cordoba:

 before_compile after_compile 

In Cordoba mode:

 before_run before_prepare after_prepare after_run 

Interestingly, run seems to trigger the preparation hooks, but does not compile (or build) the hooks. This might just be a mistake.

+8
source

Source: https://habr.com/ru/post/1235678/


All Articles