Access to .yaml in a .js


#1

Hi All,

My need is quite simple but i can’t figure it out .

i am using {% do assets.addJs(‘theme://js/mynice.js’) %} and it’s well working. I would like to use in my .js my configuration setting.

How can i send or use in mynice.js the configuration setting from site.yaml or system.yaml or theme.yaml ?

Thanks for any help !


#2

i got it so i share it :


#3

so did you find a working solution)? I have the same problem


#4

Hi,

you can override once loaded

script type="text/javascript"> 
var myparameter = '{{ config.theme.myparameter }}';  
-   and just use the  myparameter -
</script>

but finally i don’t use it for my personal case.