Hi, I just want to know how to pass the parameters to the .js file using the Roots/bundle. In the previous tag of roots sage 10 to pass the parameter to the specific .js file we can use:
But how we can achieve this using the Roots/bundle. In the latest update of sage 10 they used bundle('app')->enqueue(); to enqueue the js file but how we can use the localize_script using this bundle?
We need to update our docs to reflect the changes made to enqueuing assets when we switched over to using Bud earlier this week, but…
wp_localize_script needs to reference the handle of the enqueued asset. As of right now, app.js is built and enqueued with the handle app/1. To add a JS object to the app bundle, you’d do:
<script id='app/1-js-extra'>
var example = {"hello":"world"};
</script>
<script src='http://example.test/app/themes/sage/public/app.8bd132.js' id='app/1-js'></script>