Hi everybody,
I’d like to know which is the better way to add inline scripts in sage 10.
Sage 10 enqueues scripts in this way by deafault:
bundle('app')->enqueue();
Now I need to add an inline script when app.js is enqueued.
To doing this, I tried with this line of code:
wp_add_inline_script('sage/app.js', $js);
but it doesn’t work cause the handle is not right.
I’ve taken a look at the bundle('app')->enqueue()
method and I figured out that handles in the bundle of my theme are: “app/0”, “app/1”, “app/2”, “app/3”.
The last one seems to be the handle I need and, testing it, script is added correctly.
Is there a way to get the app.js handle? An helper or something similar?
Thank you for your help.
Valerio